[infinispan-issues] [JBoss JIRA] (ISPN-9686) Simplified clustered executor single node submission
William Burns (Jira)
issues at jboss.org
Tue Nov 6 13:02:00 EST 2018
[ https://issues.jboss.org/browse/ISPN-9686?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13657431#comment-13657431 ]
William Burns edited comment on ISPN-9686 at 11/6/18 1:01 PM:
--------------------------------------------------------------
My idea is something like
{code}
interface SingleNodeExecutor extends ClusterExecutor {
SingleNodeExecutor filterTarget(Address targetNode);
<R> CompletionStage<R> submitFunction(Function<? super EmbeddedCacheManager, ? extends R> function);
... truncate duplicate overrides ...
}
{code}
We would also have to override the other various methods to return SingleNodeExecutor as well in this interface
was (Author: william.burns):
My idea is something like
{code}
interface SingleNodeExecutor extends ClusterExecutor {
SingleNodeExecutor target(Address targetNode);
<R> CompletionStage<R> submitFunction(Function<? super EmbeddedCacheManager, ? extends R> function);
... truncate duplicate overrides ...
}
{code}
We would also have to override the other various methods to return SingleNodeExecutor as well in this interface
> 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
> Priority: Major
>
> 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