Ejemplo n.º 1
0
 @Override
 public void configure(StateMachineExecutor executor) {
   this.executor = executor;
   executor.register(
       InstanceOperation.class,
       (Function<Commit<InstanceOperation>, Object>) this::operateResource);
   executor.register(GetResource.class, this::getResource);
   executor.register(GetResourceIfExists.class, this::getResourceIfExists);
   executor.register(CloseResource.class, this::closeResource);
   executor.register(DeleteResource.class, this::deleteResource);
   executor.register(ResourceExists.class, this::resourceExists);
   executor.register(GetResourceKeys.class, this::getResourceKeys);
 }
 @Override
 public CompletableFuture<Void> execute(Runnable callback) {
   return parent.execute(callback);
 }
 @Override
 public <T> CompletableFuture<T> execute(Supplier<T> callback) {
   return parent.execute(callback);
 }
 @Override
 public Executor executor() {
   return parent.executor();
 }
 @Override
 public Serializer serializer() {
   return parent.serializer();
 }
 @Override
 public StateMachineContext context() {
   return parent.context();
 }
 @Override
 public Scheduled schedule(Duration initialDelay, Duration interval, Runnable callback) {
   Scheduled task = parent.schedule(initialDelay, interval, callback);
   tasks.add(task);
   return task;
 }
 @Override
 public Scheduled schedule(Duration delay, Runnable callback) {
   Scheduled task = parent.schedule(delay, callback);
   tasks.add(task);
   return task;
 }