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

Add <T> Future<T> submit(Address target, Callable<T> task) at least to DefaultExecutorService

    XMLWordPrintable

Details

    Description

      To easy execute tasks on specific nodes I'd like to have an additional method at DefaultExecutorService:

             public <T> Future<T> submit(Address target, Callable<T> task){
                  if (task == null) throw new NullPointerException();
                  if (target == null) throw new NullPointerException();
                  List<Address> members = rpc.getTransport().getMembers();
                  if(!members.contains(target)){
                      throw new IllegalArgumentException("Unknown node "+target.toString());
                  }
                  Address me = rpc.getAddress();
                  DistributedExecuteCommand<T> c = null;
                  if(target.equals(me)){
                      c = factory.buildDistributedExecuteCommand(clone(task), me, null);
                  } else {
                      c = factory.buildDistributedExecuteCommand(task, me, null);
                  }
                  DistributedRunnableFuture<T> f = new DistributedRunnableFuture<T>(c);
                  executeFuture(target, f);
                  return f;
              }
      

      Attachments

        Activity

          People

            vblagoje Vladimir Blagojevic (Inactive)
            tfromm_jira Thomas Fromm (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: