Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-9686

Simplified clustered executor single node submission

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • None
    • None

      When working with DistributedExecutorService I can do the following

      DistributedTask<Boolean> distributedTask = taskBuilder.build();
      Future<Boolean> future = des.submit(distributedTask);
      Boolean r = future.get();
      

      But DistributedExecutorService is deprecated and we should use ClusterExecutor

      As a developer, I would like to execute a function in another node and get the result.
      I am expecting something like:

      CompletableFuture<Boolean> future = master.executor().singleNodeSubmission(address, task);
      Boolean r = future.get();
      

      Today, I need the following code to achieve the same result

      class MutableString {
          String value;
      }
      
      MutableString mString = new MutableString();
      
      SerializableFunction<EmbeddedCacheManager, String> callable = (cm) -> {
          return "foo";
      };
      
      TriConsumer<Address, String, Throwable> triConsumer = (a, v, t) -> {
          mString.value = v;
      };
      
      master.executor().singleNodeSubmission().filterTargets(a -> a.equals(address)).submitConsumer(callable, triConsumer).get();
      
      

            Unassigned Unassigned
            dlovison@redhat.com Diego Lovison
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: