Yair Zaslavsky has posted comments on this change.
Change subject: core: introducing scheduling framework
......................................................................
Patch Set 1: (6 inline comments)
....................................................
File
backend/manager/modules/taskmgr/src/main/java/org/ovirt/engine/core/taskmgr/scheduler/SimpleOperationScheduler.java
Line 6:
Line 7: public final class SimpleOperationScheduler implements Runnable,
OperationScheduler {
Line 8:
Line 9: private class OperationEntry<T> {
Line 10:
Will take care of it, thanks.
Line 11: final private Calendar _timeout;
Line 12: final private WaitedFuture<T> _task;
Line 13: final private Callback<T> _callback;
Line 14:
Line 36: }
Line 37: }
Line 38: final private ArrayList<OperationEntry<?>> _tasks;
Line 39: final private Executor _executor;
Line 40:
Saggi wrote this outside the scope of the project, I will fix that.
Line 41: public SimpleOperationScheduler(Executor executor) {
Line 42: _tasks = new ArrayList<OperationEntry<?>>();
Line 43: _executor = executor;
Line 44: }
Line 52: _tasks.add(new OperationEntry<T>(task, callback, timeout));
Line 53: }
Line 54: /* Do a run in case the task finished before we registered
Line 55: * for notifications.
Line 56: */
Not sure I understood your comment, please elaborate.
Line 57: synchronized (this) {
Line 58: this.notify();
Line 59: }
Line 60:
....................................................
File
backend/manager/modules/taskmgr/src/main/java/org/ovirt/engine/core/taskmgr/scheduler/WaitedFutureMixin.java
Line 3: import java.util.concurrent.CountDownLatch;
Line 4: import java.util.concurrent.ExecutionException;
Line 5: import java.util.concurrent.TimeUnit;
Line 6: import java.util.concurrent.TimeoutException;
Line 7:
Future does not let you register an object to be signaled when done (see the
interface of WaitedFuture).
Line 8: public final class WaitedFutureMixin<V> implements WaitedFuture<V> {
Line 9:
Line 10: public interface Parent {
Line 11:
Line 25: _result = null;
Line 26: _waitObj = null;
Line 27: _parent = parent;
Line 28: }
Line 29:
I will take care of it throughout the code, thanks.
Line 30: public boolean cancel(boolean mayInterruptIfRunning) {
Line 31: synchronized (this) {
Line 32: if (!_cancelled) {
Line 33: _cancelled = _parent.cancel(mayInterruptIfRunning);
Line 28: }
Line 29:
Line 30: public boolean cancel(boolean mayInterruptIfRunning) {
Line 31: synchronized (this) {
Line 32: if (!_cancelled) {
As you can see we delegate the canceling attempt to parent.
We do not guarantee this as well.
Just so we are clear here - a VDSM verb like "cancel" should not be handled
this way.
This class is an extension to future capabilities, and if future attempts to
cancel , it should attempt to cancel as well.
Line 33: _cancelled = _parent.cancel(mayInterruptIfRunning);
Line 34: }
Line 35:
Line 36: return _cancelled;
--
To view, visit http://gerrit.ovirt.org/13795
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I07253e8465776482bbdade21d78e9b40eeaadbb5
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: Michael Kublin <[email protected]>
Gerrit-Reviewer: Ravi Nori <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches