コード例 #1
0
 void fireInterrupted(InterruptedException exception) {
   TaskEvent<InterruptedException> event = TaskEvent.interrupted(task, exception);
   LOG.debug("firing interrupted event: {}", event);
   for (TaskListener<? super T> listener : listeners) {
     listener.interrupted(event);
   }
 }
コード例 #2
0
 void fireCanceled() {
   TaskEvent<Void> event = TaskEvent.started(task);
   LOG.debug("firing canceled event: {}", event);
   for (TaskListener<? super T> listener : listeners) {
     listener.canceled(event);
   }
 }
コード例 #3
0
 void fireFinished() {
   TaskEvent<Void> event = TaskEvent.finished(task);
   LOG.debug("firing finished event: {}", event);
   for (TaskListener<? super T> listener : listeners) {
     listener.finished(event);
   }
 }
コード例 #4
0
 void fireSucceeded(T value) {
   TaskEvent<T> event = TaskEvent.succeeded(task, value);
   LOG.debug("firing succeeded event: {}", event);
   for (TaskListener<? super T> listener : listeners) {
     listener.succeeded(event);
   }
 }
コード例 #5
0
 void fireFailed(Throwable exception) {
   TaskEvent<Throwable> event = TaskEvent.failed(task, exception);
   LOG.debug("firing failed event: {}", event);
   for (TaskListener<? super T> listener : listeners) {
     listener.failed(event);
   }
 }
コード例 #6
0
ファイル: ConditionalTask.java プロジェクト: VitalPet/OPEN
 /**
  * Invoked when a task completes or is cancelled.
  *
  * @param event the event
  */
 private void onTaskEvent(TaskEvent event) {
   switch (event.getType()) {
     case SKIPPED:
       notifySkipped();
       break;
     case CANCELLED:
       notifyCancelled();
       break;
     case COMPLETED:
       notifyCompleted();
       break;
   }
 }
コード例 #7
0
ファイル: ConditionalTask.java プロジェクト: VitalPet/OPEN
 /**
  * Invoked when the condition task completes or is cancelled.
  *
  * @param event the event
  */
 private void onConditionEvent(TaskEvent event) {
   switch (event.getType()) {
     case SKIPPED:
       notifySkipped();
       break;
     case CANCELLED:
       notifyCancelled();
       break;
     case COMPLETED:
       if (condition.getValue()) {
         start(task, context);
       } else if (elseTask != null) {
         start(elseTask, context);
       } else {
         notifyCompleted();
       }
       break;
   }
 }