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

      // if (context.getParentContext().isPresent()) {
      //   context.getParentContext().get().close();
      // }
    }
Beispiel #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);
   }
 }
Beispiel #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);
   }
 }
Beispiel #5
0
 @Override
 public void onNext(final RunningTask runningTask) {
   checkMsgOrder(runningTask);
   FailDriver.this.task = runningTask;
   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());
 }
Beispiel #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);
   }
 }
Beispiel #7
0
 @Override
 public void onNext(final SuspendedTask suspendedTask) {
   checkMsgOrder(suspendedTask);
   state = DriverState.RESUME;
   try {
     suspendedTask
         .getActiveContext()
         .submitTask(
             TaskConfiguration.CONF
                 .set(TaskConfiguration.IDENTIFIER, suspendedTask.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);
   }
 }
Beispiel #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());
 }