예제 #1
0
 @Override
 public void onNext(final FailedTask task) {
   LOG.log(Level.WARNING, "Task failed: " + task.getId(), task.getReason().orElse(null));
   checkMsgOrder(task);
   if (task.getActiveContext().isPresent()) {
     task.getActiveContext().get().close();
   }
 }
예제 #2
0
    @Override
    public void onNext(final FailedContext context) {
      LOG.log(
          Level.WARNING, "Context failed: " + context.getId(), context.getReason().orElse(null));
      checkMsgOrder(context);
      // TODO: notify client?

      // if (context.getParentContext().isPresent()) {
      //   context.getParentContext().get().close();
      // }
    }
예제 #3
0
 @Override
 public void onNext(final AllocatedEvaluator eval) {
   checkMsgOrder(eval);
   try {
     eval.submitContext(
         ContextConfiguration.CONF
             .set(ContextConfiguration.IDENTIFIER, "FailContext_" + eval.getId())
             .build());
   } catch (final BindException ex) {
     LOG.log(Level.WARNING, "Context configuration error", ex);
     throw new RuntimeException(ex);
   }
 }
예제 #4
0
 @Override
 public void onNext(final Alarm time) {
   FailDriver.this.checkMsgOrder(time);
   switch (FailDriver.this.state) {
     case SEND_MSG:
       FailDriver.this.task.send(HELLO_STR);
       break;
     case SUSPEND:
       FailDriver.this.task.suspend();
       break;
     case CLOSE:
       FailDriver.this.task.close();
       break;
     default:
       LOG.log(Level.WARNING, "Unexpected state at AlarmHandler: {0}", FailDriver.this.state);
       throw new DriverSideFailure("Unexpected state: " + FailDriver.this.state);
   }
 }
예제 #5
0
 @Override
 public void onNext(final RunningTask task) {
   checkMsgOrder(task);
   FailDriver.this.task = task;
   switch (state) {
     case INIT:
       state = DriverState.SEND_MSG;
       break;
     case RESUME:
       state = DriverState.CLOSE;
       break;
     default:
       LOG.log(Level.WARNING, "Unexpected state at TaskRuntime: {0}", state);
       throw new DriverSideFailure("Unexpected state: " + state);
   }
   // After a delay, send message or suspend the task:
   clock.scheduleAlarm(MSG_DELAY, new AlarmHandler());
 }
예제 #6
0
 @Override
 public void onNext(final ActiveContext context) {
   checkMsgOrder(context);
   try {
     context.submitTask(
         TaskConfiguration.CONF
             .set(TaskConfiguration.IDENTIFIER, "FailTask_" + context.getId())
             .set(TaskConfiguration.TASK, NoopTask.class)
             .set(TaskConfiguration.ON_MESSAGE, NoopTask.DriverMessageHandler.class)
             .set(TaskConfiguration.ON_SUSPEND, NoopTask.TaskSuspendHandler.class)
             .set(TaskConfiguration.ON_CLOSE, NoopTask.TaskCloseHandler.class)
             .set(TaskConfiguration.ON_TASK_STOP, NoopTask.TaskStopHandler.class)
             .set(TaskConfiguration.ON_SEND_MESSAGE, NoopTask.class)
             .build());
   } catch (final BindException ex) {
     LOG.log(Level.WARNING, "Task configuration error", ex);
     throw new RuntimeException(ex);
   }
 }
예제 #7
0
 @Override
 public void onNext(final SuspendedTask task) {
   checkMsgOrder(task);
   state = DriverState.RESUME;
   try {
     task.getActiveContext()
         .submitTask(
             TaskConfiguration.CONF
                 .set(TaskConfiguration.IDENTIFIER, task.getId() + "_RESUMED")
                 .set(TaskConfiguration.TASK, NoopTask.class)
                 .set(TaskConfiguration.ON_MESSAGE, NoopTask.DriverMessageHandler.class)
                 .set(TaskConfiguration.ON_SUSPEND, NoopTask.TaskSuspendHandler.class)
                 .set(TaskConfiguration.ON_CLOSE, NoopTask.TaskCloseHandler.class)
                 .set(TaskConfiguration.ON_TASK_STOP, NoopTask.TaskStopHandler.class)
                 .set(TaskConfiguration.ON_SEND_MESSAGE, NoopTask.class)
                 .set(TaskConfiguration.MEMENTO, DatatypeConverter.printBase64Binary(HELLO_STR))
                 .build());
   } catch (final BindException ex) {
     LOG.log(Level.SEVERE, "Task configuration error", ex);
     throw new DriverSideFailure("Task configuration error", ex);
   }
 }
예제 #8
0
 @Override
 public void onNext(final FailedEvaluator eval) {
   LOG.log(Level.WARNING, "Evaluator failed: " + eval.getId(), eval.getEvaluatorException());
   checkMsgOrder(eval);
   throw new RuntimeException(eval.getEvaluatorException());
 }