[infinispan-issues] [JBoss JIRA] (ISPN-9686) Simplified clustered executor single node submission

Diego Lovison (Jira) issues at jboss.org
Tue Nov 6 12:50:00 EST 2018


Diego Lovison created ISPN-9686:
-----------------------------------

             Summary: Simplified clustered executor single node submission
                 Key: ISPN-9686
                 URL: https://issues.jboss.org/browse/ISPN-9686
             Project: Infinispan
          Issue Type: Enhancement
            Reporter: Diego Lovison


When working with *DistributedExecutorService* I can do the following

{code:java}
DistributedTask<Boolean> distributedTask = taskBuilder.build();
Future<Boolean> future = des.submit(distributedTask);
Boolean r = future.get();
{code}

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:


{code:java}
CompletableFuture<Boolean> future = master.executor().singleNodeSubmission(address, task);
Boolean r = future.get();
{code}

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

{code:java}

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();

{code}




--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the infinispan-issues mailing list