com.hazelcast.client.proxy
Class ClientExecutorServiceProxy

java.lang.Object
  extended by com.hazelcast.client.spi.ClientProxy
      extended by com.hazelcast.client.proxy.ClientExecutorServiceProxy
All Implemented Interfaces:
DistributedObject, IExecutorService, Executor, ExecutorService

public class ClientExecutorServiceProxy
extends ClientProxy
implements IExecutorService

Author:
ali 5/24/13

Constructor Summary
ClientExecutorServiceProxy(String serviceName, String objectId)
           
 
Method Summary
 boolean awaitTermination(long timeout, TimeUnit unit)
           
 void execute(Runnable command)
           
 void execute(Runnable command, MemberSelector memberSelector)
          Executes a task on a randomly selected member.
 void executeOnAllMembers(Runnable command)
          Executes a task on all of the known cluster members.
 void executeOnKeyOwner(Runnable command, Object key)
          Executes a task on the owner of the specified key.
 void executeOnMember(Runnable command, Member member)
          Executes a task on the specified member.
 void executeOnMembers(Runnable command, Collection<Member> members)
          Executes a task on each of the specified members.
 void executeOnMembers(Runnable command, MemberSelector memberSelector)
          Executes a task on each of the selected members.
 LocalExecutorStats getLocalExecutorStats()
          Returns local statistics related to this executor service.
<T> List<Future<T>>
invokeAll(Collection<? extends Callable<T>> tasks)
           
<T> List<Future<T>>
invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
           
<T> T
invokeAny(Collection<? extends Callable<T>> tasks)
           
<T> T
invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
           
 boolean isShutdown()
           
 boolean isTerminated()
           
 void shutdown()
           
 List<Runnable> shutdownNow()
           
<T> Future<T>
submit(Callable<T> task)
           
<T> void
submit(Callable<T> task, ExecutionCallback<T> callback)
          Submits a task to a random member.
<T> Future<T>
submit(Callable<T> task, MemberSelector memberSelector)
          Submits a task to a randomly selected member and returns a Future representing that task.
<T> void
submit(Callable<T> task, MemberSelector memberSelector, ExecutionCallback<T> callback)
          Submits task to a randomly selected member.
 Future<?> submit(Runnable command)
           
 void submit(Runnable command, ExecutionCallback callback)
          Submits a task to a random member.
 void submit(Runnable task, MemberSelector memberSelector, ExecutionCallback callback)
          Submits a task to randomly selected members.
<T> Future<T>
submit(Runnable command, T result)
           
<T> Map<Member,Future<T>>
submitToAllMembers(Callable<T> task)
          Submits task to all cluster members and returns a map of Member-Future pairs representing pending completion of the task on each member.
<T> void
submitToAllMembers(Callable<T> task, MultiExecutionCallback callback)
          Submits task to all the cluster members.
 void submitToAllMembers(Runnable command, MultiExecutionCallback callback)
          Submits task to all the cluster members.
<T> Future<T>
submitToKeyOwner(Callable<T> task, Object key)
          Submits a task to the owner of the specified key and returns a Future representing that task.
<T> void
submitToKeyOwner(Callable<T> task, Object key, ExecutionCallback<T> callback)
          Submits task to the owner of the specified key.
 void submitToKeyOwner(Runnable command, Object key, ExecutionCallback callback)
          Submits a task to the owner of the specified key.
<T> Future<T>
submitToMember(Callable<T> task, Member member)
          Submits a task to the specified member and returns a Future representing that task.
<T> void
submitToMember(Callable<T> task, Member member, ExecutionCallback<T> callback)
          Submits a task to the specified member.
 void submitToMember(Runnable command, Member member, ExecutionCallback callback)
          Submits a task to the specified member.
<T> Map<Member,Future<T>>
submitToMembers(Callable<T> task, Collection<Member> members)
          Submits a task to given members and returns map of Member-Future pairs representing pending completion of the task on each member
<T> void
submitToMembers(Callable<T> task, Collection<Member> members, MultiExecutionCallback callback)
          Submits a task to the specified members.
<T> Map<Member,Future<T>>
submitToMembers(Callable<T> task, MemberSelector memberSelector)
          Submits a task to selected members and returns a map of Member-Future pairs representing pending completion of the task on each member.
<T> void
submitToMembers(Callable<T> task, MemberSelector memberSelector, MultiExecutionCallback callback)
          Submits task to the selected members.
 void submitToMembers(Runnable command, Collection<Member> members, MultiExecutionCallback callback)
          Submits a task to the specified members.
 void submitToMembers(Runnable task, MemberSelector memberSelector, MultiExecutionCallback callback)
          Submits task to the selected members.
 String toString()
           
 
Methods inherited from class com.hazelcast.client.spi.ClientProxy
destroy, equals, getContext, getId, getName, getPartitionKey, getServiceName, hashCode, invoke, invoke, invoke, invokeInterruptibly, listen, listen, onDestroy, onInitialize, onShutdown, setContext, stopListening, throwExceptionIfNull, toData, toObject
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.hazelcast.core.DistributedObject
destroy, getId, getName, getPartitionKey, getServiceName
 

Constructor Detail

ClientExecutorServiceProxy

public ClientExecutorServiceProxy(String serviceName,
                                  String objectId)
Method Detail

execute

public void execute(Runnable command)
Specified by:
execute in interface Executor

executeOnKeyOwner

public void executeOnKeyOwner(Runnable command,
                              Object key)
Description copied from interface: IExecutorService
Executes a task on the owner of the specified key.

Specified by:
executeOnKeyOwner in interface IExecutorService
Parameters:
command - a task executed on the owner of the specified key
key - the specified key

executeOnMember

public void executeOnMember(Runnable command,
                            Member member)
Description copied from interface: IExecutorService
Executes a task on the specified member.

Specified by:
executeOnMember in interface IExecutorService
Parameters:
command - the task executed on the specified member
member - the specified member

executeOnMembers

public void executeOnMembers(Runnable command,
                             Collection<Member> members)
Description copied from interface: IExecutorService
Executes a task on each of the specified members.

Specified by:
executeOnMembers in interface IExecutorService
Parameters:
command - the task executed on the specified members
members - the specified members

execute

public void execute(Runnable command,
                    MemberSelector memberSelector)
Description copied from interface: IExecutorService
Executes a task on a randomly selected member.

Specified by:
execute in interface IExecutorService
Parameters:
command - the task that is executed on a randomly selected member
memberSelector - memberSelector

executeOnMembers

public void executeOnMembers(Runnable command,
                             MemberSelector memberSelector)
Description copied from interface: IExecutorService
Executes a task on each of the selected members.

Specified by:
executeOnMembers in interface IExecutorService
Parameters:
command - a task executed on each of the selected members
memberSelector - memberSelector

executeOnAllMembers

public void executeOnAllMembers(Runnable command)
Description copied from interface: IExecutorService
Executes a task on all of the known cluster members.

Specified by:
executeOnAllMembers in interface IExecutorService
Parameters:
command - a task executed on all of the known cluster members

submitToMember

public <T> Future<T> submitToMember(Callable<T> task,
                                    Member member)
Description copied from interface: IExecutorService
Submits a task to the specified member and returns a Future representing that task.

Specified by:
submitToMember in interface IExecutorService
Parameters:
task - the task submitted to the specified member
member - the specified member
Returns:
a Future representing pending completion of the task

submitToMembers

public <T> Map<Member,Future<T>> submitToMembers(Callable<T> task,
                                                 Collection<Member> members)
Description copied from interface: IExecutorService
Submits a task to given members and returns map of Member-Future pairs representing pending completion of the task on each member

Specified by:
submitToMembers in interface IExecutorService
Parameters:
task - the task submitted to given members
members - the given members
Returns:
map of Member-Future pairs representing pending completion of the task on each member

submit

public <T> Future<T> submit(Callable<T> task,
                            MemberSelector memberSelector)
Description copied from interface: IExecutorService
Submits a task to a randomly selected member and returns a Future representing that task.

Specified by:
submit in interface IExecutorService
Parameters:
task - task submitted to a randomly selected member
memberSelector - memberSelector
Returns:
a Future representing pending completion of the task

submitToMembers

public <T> Map<Member,Future<T>> submitToMembers(Callable<T> task,
                                                 MemberSelector memberSelector)
Description copied from interface: IExecutorService
Submits a task to selected members and returns a map of Member-Future pairs representing pending completion of the task on each member.

Specified by:
submitToMembers in interface IExecutorService
Parameters:
task - the task submitted to selected members
memberSelector - memberSelector
Returns:
map of Member-Future pairs representing pending completion of the task on each member

submitToAllMembers

public <T> Map<Member,Future<T>> submitToAllMembers(Callable<T> task)
Description copied from interface: IExecutorService
Submits task to all cluster members and returns a map of Member-Future pairs representing pending completion of the task on each member.

Specified by:
submitToAllMembers in interface IExecutorService
Parameters:
task - the task submitted to all cluster members
Returns:
map of Member-Future pairs representing pending completion of the task on each member

submitToMember

public void submitToMember(Runnable command,
                           Member member,
                           ExecutionCallback callback)
Description copied from interface: IExecutorService
Submits a task to the specified member. Caller will be notified for the result of the task by ExecutionCallback.onResponse(Object) or ExecutionCallback.onFailure(Throwable).

Specified by:
submitToMember in interface IExecutorService
Parameters:
command - the task submitted to the specified member
member - the specified member
callback - callback

submitToMembers

public void submitToMembers(Runnable command,
                            Collection<Member> members,
                            MultiExecutionCallback callback)
Description copied from interface: IExecutorService
Submits a task to the specified members. Caller will be notified for the result of the each task by MultiExecutionCallback.onResponse(Member, Object), and when all tasks are completed, MultiExecutionCallback.onComplete(java.util.Map) will be called.

Specified by:
submitToMembers in interface IExecutorService
Parameters:
command - the task submitted to the specified members
members - the specified members
callback - callback

submitToMember

public <T> void submitToMember(Callable<T> task,
                               Member member,
                               ExecutionCallback<T> callback)
Description copied from interface: IExecutorService
Submits a task to the specified member. Caller will be notified for the result of the task by ExecutionCallback.onResponse(Object) or ExecutionCallback.onFailure(Throwable).

Specified by:
submitToMember in interface IExecutorService
Parameters:
task - the task submitted to the specified member
callback - callback

submitToMembers

public <T> void submitToMembers(Callable<T> task,
                                Collection<Member> members,
                                MultiExecutionCallback callback)
Description copied from interface: IExecutorService
Submits a task to the specified members. Caller will be notified for the result of each task by MultiExecutionCallback.onResponse(Member, Object), and when all tasks are completed, MultiExecutionCallback.onComplete(java.util.Map) will be called.

Specified by:
submitToMembers in interface IExecutorService
Parameters:
task - the task submitted to the specified members
members - the specified members
callback - callback

submit

public void submit(Runnable task,
                   MemberSelector memberSelector,
                   ExecutionCallback callback)
Description copied from interface: IExecutorService
Submits a task to randomly selected members. Caller will be notified for the result of the task by ExecutionCallback.onResponse(Object) or ExecutionCallback.onFailure(Throwable).

Specified by:
submit in interface IExecutorService
Parameters:
task - the task submitted to randomly selected members
memberSelector - memberSelector
callback - callback

submitToMembers

public void submitToMembers(Runnable task,
                            MemberSelector memberSelector,
                            MultiExecutionCallback callback)
Description copied from interface: IExecutorService
Submits task to the selected members. Caller will be notified for the result of the each task by MultiExecutionCallback.onResponse(Member, Object), and when all tasks are completed, MultiExecutionCallback.onComplete(java.util.Map) will be called.

Specified by:
submitToMembers in interface IExecutorService
Parameters:
task - the task submitted to the selected members
memberSelector - memberSelector
callback - callback

submit

public <T> void submit(Callable<T> task,
                       MemberSelector memberSelector,
                       ExecutionCallback<T> callback)
Description copied from interface: IExecutorService
Submits task to a randomly selected member. Caller will be notified for the result of the task by ExecutionCallback.onResponse(Object) or ExecutionCallback.onFailure(Throwable).

Specified by:
submit in interface IExecutorService
Parameters:
task - the task submitted to a randomly selected member
memberSelector - memberSelector
callback - callback

submitToMembers

public <T> void submitToMembers(Callable<T> task,
                                MemberSelector memberSelector,
                                MultiExecutionCallback callback)
Description copied from interface: IExecutorService
Submits task to the selected members. Caller will be notified for the result of each task by MultiExecutionCallback.onResponse(Member, Object), and when all tasks are completed, MultiExecutionCallback.onComplete(java.util.Map) will be called.

Specified by:
submitToMembers in interface IExecutorService
Parameters:
task - the task submitted to the selected members
memberSelector - memberSelector
callback - callback

submitToAllMembers

public void submitToAllMembers(Runnable command,
                               MultiExecutionCallback callback)
Description copied from interface: IExecutorService
Submits task to all the cluster members. Caller will be notified for the result of each task by MultiExecutionCallback.onResponse(Member, Object), and when all tasks are completed, MultiExecutionCallback.onComplete(java.util.Map) will be called.

Specified by:
submitToAllMembers in interface IExecutorService
Parameters:
command - the task submitted to all the cluster members
callback - callback

submitToAllMembers

public <T> void submitToAllMembers(Callable<T> task,
                                   MultiExecutionCallback callback)
Description copied from interface: IExecutorService
Submits task to all the cluster members. Caller will be notified for the result of the each task by MultiExecutionCallback.onResponse(Member, Object), and when all tasks are completed, MultiExecutionCallback.onComplete(java.util.Map) will be called.

Specified by:
submitToAllMembers in interface IExecutorService
Parameters:
task - the task submitted to all the cluster members
callback - callback

submit

public Future<?> submit(Runnable command)
Specified by:
submit in interface ExecutorService

submit

public <T> Future<T> submit(Runnable command,
                            T result)
Specified by:
submit in interface ExecutorService

submit

public <T> Future<T> submit(Callable<T> task)
Specified by:
submit in interface ExecutorService

submit

public void submit(Runnable command,
                   ExecutionCallback callback)
Description copied from interface: IExecutorService
Submits a task to a random member. Caller will be notified of the result of the task by ExecutionCallback.onResponse(Object) or ExecutionCallback.onFailure(Throwable).

Specified by:
submit in interface IExecutorService
Parameters:
command - a task submitted to a random member
callback - callback

submit

public <T> void submit(Callable<T> task,
                       ExecutionCallback<T> callback)
Description copied from interface: IExecutorService
Submits a task to a random member. Caller will be notified for the result of the task by ExecutionCallback.onResponse(Object) or ExecutionCallback.onFailure(Throwable).

Specified by:
submit in interface IExecutorService
Parameters:
task - the task submitted to a random member
callback - callback

submitToKeyOwner

public <T> Future<T> submitToKeyOwner(Callable<T> task,
                                      Object key)
Description copied from interface: IExecutorService
Submits a task to the owner of the specified key and returns a Future representing that task.

Specified by:
submitToKeyOwner in interface IExecutorService
Parameters:
task - task submitted to the owner of the specified key
key - the specified key
Returns:
a Future representing pending completion of the task

submitToKeyOwner

public void submitToKeyOwner(Runnable command,
                             Object key,
                             ExecutionCallback callback)
Description copied from interface: IExecutorService
Submits a task to the owner of the specified key. Caller will be notified for the result of the task by ExecutionCallback.onResponse(Object) or ExecutionCallback.onFailure(Throwable).

Specified by:
submitToKeyOwner in interface IExecutorService
Parameters:
command - task submitted to the owner of the specified key
key - the specified key
callback - callback

submitToKeyOwner

public <T> void submitToKeyOwner(Callable<T> task,
                                 Object key,
                                 ExecutionCallback<T> callback)
Description copied from interface: IExecutorService
Submits task to the owner of the specified key. Caller will be notified for the result of the task by ExecutionCallback.onResponse(Object) or ExecutionCallback.onFailure(Throwable).

Specified by:
submitToKeyOwner in interface IExecutorService
Parameters:
task - the task submitted to the owner of the specified key
callback - callback

getLocalExecutorStats

public LocalExecutorStats getLocalExecutorStats()
Description copied from interface: IExecutorService
Returns local statistics related to this executor service.

Specified by:
getLocalExecutorStats in interface IExecutorService
Returns:
local statistics related to this executor service

shutdown

public void shutdown()
Specified by:
shutdown in interface ExecutorService

shutdownNow

public List<Runnable> shutdownNow()
Specified by:
shutdownNow in interface ExecutorService

isShutdown

public boolean isShutdown()
Specified by:
isShutdown in interface ExecutorService

isTerminated

public boolean isTerminated()
Specified by:
isTerminated in interface ExecutorService

awaitTermination

public boolean awaitTermination(long timeout,
                                TimeUnit unit)
                         throws InterruptedException
Specified by:
awaitTermination in interface ExecutorService
Throws:
InterruptedException

invokeAll

public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)
                          throws InterruptedException
Specified by:
invokeAll in interface ExecutorService
Throws:
InterruptedException

invokeAll

public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks,
                                     long timeout,
                                     TimeUnit unit)
                          throws InterruptedException
Specified by:
invokeAll in interface ExecutorService
Throws:
InterruptedException

invokeAny

public <T> T invokeAny(Collection<? extends Callable<T>> tasks)
            throws InterruptedException,
                   ExecutionException
Specified by:
invokeAny in interface ExecutorService
Throws:
InterruptedException
ExecutionException

invokeAny

public <T> T invokeAny(Collection<? extends Callable<T>> tasks,
                       long timeout,
                       TimeUnit unit)
            throws InterruptedException,
                   ExecutionException,
                   TimeoutException
Specified by:
invokeAny in interface ExecutorService
Throws:
InterruptedException
ExecutionException
TimeoutException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.