public class ClientScheduledExecutorProxy extends ClientProxy implements IScheduledExecutorService
IScheduledExecutorService.name| Constructor and Description |
|---|
ClientScheduledExecutorProxy(String serviceName,
String objectId,
ClientContext context) |
| Modifier and Type | Method and Description |
|---|---|
<V> Map<Member,List<IScheduledFuture<V>>> |
getAllScheduledFutures()
Fetches and returns all scheduled (not disposed yet) futures from all
members in the cluster.
|
<V> IScheduledFuture<V> |
getScheduledFuture(ScheduledTaskHandler handler)
Creates a new
IScheduledFuture from the given handler. |
protected ClientMessage |
invokeOnPartition(ClientMessage req) |
protected <T> T |
invokeOnPartition(ClientMessage clientMessage,
long invocationTimeoutSeconds) |
protected <T> ClientDelegatingFuture<T> |
invokeOnPartitionAsync(ClientMessage clientMessage,
ClientMessageDecoder clientMessageDecoder) |
protected <T> T |
invokeOnPartitionInterruptibly(ClientMessage clientMessage) |
protected <T> T |
invokeOnPartitionInterruptibly(ClientMessage clientMessage,
long invocationTimeoutSeconds) |
protected void |
onInitialize()
Called when proxy is created.
|
<V> IScheduledFuture<V> |
schedule(Callable<V> command,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the given delay.
|
<V> IScheduledFuture<V> |
schedule(Runnable command,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the given delay.
|
<V> IScheduledFuture<V> |
scheduleAtFixedRate(Runnable command,
long initialDelay,
long period,
TimeUnit unit)
Creates and executes a periodic action that becomes enabled first after
the given initial delay, and subsequently with the given period.
|
<V> Map<Member,IScheduledFuture<V>> |
scheduleOnAllMembers(Callable<V> command,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the
given delay on all cluster
Members. |
<V> Map<Member,IScheduledFuture<V>> |
scheduleOnAllMembers(Runnable command,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the
given delay on all cluster
Members. |
<V> Map<Member,IScheduledFuture<V>> |
scheduleOnAllMembersAtFixedRate(Runnable command,
long initialDelay,
long period,
TimeUnit unit)
Creates and executes a periodic action that becomes enabled first after
the given initial delay, and subsequently with the given period on all
cluster
Members. |
<V> IScheduledFuture<V> |
scheduleOnKeyOwner(Callable<V> command,
Object key,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the
given delay on the partition owner of the given key.
|
<V> IScheduledFuture<V> |
scheduleOnKeyOwner(Runnable command,
Object key,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the
given delay on the partition owner of the given key.
|
<V> IScheduledFuture<V> |
scheduleOnKeyOwnerAtFixedRate(Runnable command,
Object key,
long initialDelay,
long period,
TimeUnit unit)
Creates and executes a periodic action that becomes enabled first after
the given initial delay, and subsequently with the given period on the
partition owner of the given key.
|
<V> IScheduledFuture<V> |
scheduleOnMember(Callable<V> command,
Member member,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the
given delay at the given
Member. |
<V> IScheduledFuture<V> |
scheduleOnMember(Runnable command,
Member member,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the
given delay at the given
Member. |
<V> IScheduledFuture<V> |
scheduleOnMemberAtFixedRate(Runnable command,
Member member,
long initialDelay,
long period,
TimeUnit unit)
Creates and executes a periodic action that becomes enabled first after
the given initial delay, and subsequently with the given period at the
given
Member. |
<V> Map<Member,IScheduledFuture<V>> |
scheduleOnMembers(Callable<V> command,
Collection<Member> members,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the
given delay on all
Members given. |
<V> Map<Member,IScheduledFuture<V>> |
scheduleOnMembers(Runnable command,
Collection<Member> members,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the
given delay on all
Members given. |
<V> Map<Member,IScheduledFuture<V>> |
scheduleOnMembersAtFixedRate(Runnable command,
Collection<Member> members,
long initialDelay,
long period,
TimeUnit unit)
Creates and executes a periodic action that becomes enabled first after
the given initial delay, and subsequently with the given period on all
Members given. |
void |
shutdown()
Initiates an orderly shutdown in which previously submitted tasks are
executed, but no new tasks will be accepted.
|
String |
toString() |
deregisterListener, destroy, destroyLocally, destroyRemotely, equals, getClient, getContext, getDistributedObjectName, getId, getName, getPartitionKey, getSerializationService, getServiceName, hashCode, invoke, invoke, invokeOnAddress, invokeOnPartition, invokeOnPartitionInterruptibly, onDestroy, onShutdown, postDestroy, preDestroy, registerListener, toData, toObjectclone, finalize, getClass, notify, notifyAll, wait, wait, waitdestroy, getName, getPartitionKey, getServiceNamepublic ClientScheduledExecutorProxy(String serviceName, String objectId, ClientContext context)
@Nonnull public <V> IScheduledFuture<V> schedule(@Nonnull Runnable command, long delay, @Nonnull TimeUnit unit)
IScheduledExecutorServiceschedule in interface IScheduledExecutorServicecommand - the task to executedelay - the time from now to delay executionunit - the time unit of the delay parameterget() method will return null upon completion@Nonnull public <V> IScheduledFuture<V> schedule(@Nonnull Callable<V> command, long delay, @Nonnull TimeUnit unit)
IScheduledExecutorServiceschedule in interface IScheduledExecutorServicecommand - the task to executedelay - the time from now to delay executionunit - the time unit of the delay parameterget() method will return null upon completion@Nonnull public <V> IScheduledFuture<V> scheduleAtFixedRate(@Nonnull Runnable command, long initialDelay, long period, @Nonnull TimeUnit unit)
IScheduledExecutorServiceinitialDelay then
initialDelay+period, then initialDelay + 2 * period,
and so on. If any execution of this task takes longer than its period,
then subsequent execution will be skipped. If any execution of the task
encounters an exception, subsequent executions are suppressed.
Otherwise, the task will only terminate via cancellation or termination
of the executor.scheduleAtFixedRate in interface IScheduledExecutorServicecommand - the task to executeinitialDelay - the time to delay first executionperiod - the period between successive executionsunit - the time unit of the initialDelay and period parametersget() method will throw an exception upon cancellation@Nonnull public <V> IScheduledFuture<V> scheduleOnMember(@Nonnull Runnable command, @Nonnull Member member, long delay, @Nonnull TimeUnit unit)
IScheduledExecutorServiceMember.scheduleOnMember in interface IScheduledExecutorServicecommand - the task to executemember - the member to execute the taskdelay - the time from now to delay executionunit - the time unit of the delay parameterget() method will return null upon completion@Nonnull public <V> IScheduledFuture<V> scheduleOnMember(@Nonnull Callable<V> command, @Nonnull Member member, long delay, @Nonnull TimeUnit unit)
IScheduledExecutorServiceMember.scheduleOnMember in interface IScheduledExecutorServicecommand - the task to executemember - the member to execute the taskdelay - the time from now to delay executionunit - the time unit of the delay parameterget() method will return null upon completion@Nonnull public <V> IScheduledFuture<V> scheduleOnMemberAtFixedRate(@Nonnull Runnable command, @Nonnull Member member, long initialDelay, long period, @Nonnull TimeUnit unit)
IScheduledExecutorServiceMember.
Executions will commence after initialDelay then
initialDelay+period, then initialDelay + 2 * period, and
so on. If any execution of this task takes longer than its period, then
subsequent execution will be skipped. If any execution of the task
encounters an exception, subsequent executions are suppressed.
Otherwise, the task will only terminate via cancellation or termination
of the executor.scheduleOnMemberAtFixedRate in interface IScheduledExecutorServicecommand - the task to executemember - the member to execute the taskinitialDelay - the time to delay first executionperiod - the period between successive executionsunit - the time unit of the initialDelay and period parametersget() method will throw an exception upon cancellation@Nonnull public <V> IScheduledFuture<V> scheduleOnKeyOwner(@Nonnull Runnable command, @Nonnull Object key, long delay, @Nonnull TimeUnit unit)
IScheduledExecutorServicescheduleOnKeyOwner in interface IScheduledExecutorServicecommand - the task to executekey - the key to identify the partition owner, which will execute the taskdelay - the time from now to delay executionunit - the time unit of the delay parameterget() method will return null upon completion@Nonnull public <V> IScheduledFuture<V> scheduleOnKeyOwner(@Nonnull Callable<V> command, @Nonnull Object key, long delay, @Nonnull TimeUnit unit)
IScheduledExecutorServicescheduleOnKeyOwner in interface IScheduledExecutorServicecommand - the task to executekey - the key to identify the partition owner, which will execute the taskdelay - the time from now to delay executionunit - the time unit of the delay parameterget() method will return null upon completion@Nonnull public <V> IScheduledFuture<V> scheduleOnKeyOwnerAtFixedRate(@Nonnull Runnable command, @Nonnull Object key, long initialDelay, long period, @Nonnull TimeUnit unit)
IScheduledExecutorServiceinitialDelay then initialDelay+period, then
initialDelay + 2 * period, and so on. If any execution of this
task takes longer than its period, then subsequent execution will be skipped.
If any execution of the task encounters an exception, subsequent executions
are suppressed.
Otherwise, the task will only terminate via cancellation or termination
of the executor.scheduleOnKeyOwnerAtFixedRate in interface IScheduledExecutorServicecommand - the task to executekey - the key to identify the partition owner, which will execute the taskinitialDelay - the time to delay first executionperiod - the period between successive executionsunit - the time unit of the initialDelay and period parametersget() method will throw an exception upon cancellation@Nonnull public <V> Map<Member,IScheduledFuture<V>> scheduleOnAllMembers(@Nonnull Runnable command, long delay, @Nonnull TimeUnit unit)
IScheduledExecutorServiceMembers.
Note: In the event of Member leaving the cluster, for whatever reason, the task is lost. If a new member is added, the task will not get scheduled there automatically.
scheduleOnAllMembers in interface IScheduledExecutorServicecommand - the task to executedelay - the time from now to delay executionunit - the time unit of the delay parameterget() method will return null upon completion@Nonnull public <V> Map<Member,IScheduledFuture<V>> scheduleOnAllMembers(@Nonnull Callable<V> command, long delay, @Nonnull TimeUnit unit)
IScheduledExecutorServiceMembers.
Note: In the event of Member leaving the cluster, for whatever reason, the task is lost. If a new member is added, the task will not get scheduled there automatically.
scheduleOnAllMembers in interface IScheduledExecutorServicecommand - the task to executedelay - the time from now to delay executionunit - the time unit of the delay parameterget() method will return null upon completion@Nonnull public <V> Map<Member,IScheduledFuture<V>> scheduleOnAllMembersAtFixedRate(@Nonnull Runnable command, long initialDelay, long period, @Nonnull TimeUnit unit)
IScheduledExecutorServiceMembers. Executions will commence after
initialDelay then initialDelay+period, then
initialDelay + 2 * period, and so on. If any execution of this
task takes longer than its period, then subsequent execution will be
skipped. If any execution of the task encounters an exception, subsequent
executions are suppressed.
Otherwise, the task will only terminate via cancellation or termination
of the executor.
Note: In the event of Member leaving the cluster, for whatever reason, the task is lost. If a new member is added, the task will not get scheduled there automatically.
scheduleOnAllMembersAtFixedRate in interface IScheduledExecutorServicecommand - the task to executeinitialDelay - the time to delay first executionperiod - the period between successive executionsunit - the time unit of the initialDelay and period parametersget() method will throw an exception upon cancellation@Nonnull public <V> Map<Member,IScheduledFuture<V>> scheduleOnMembers(@Nonnull Runnable command, @Nonnull Collection<Member> members, long delay, @Nonnull TimeUnit unit)
IScheduledExecutorServiceMembers given.
Note: In the event of Member leaving the cluster, for whatever reason, the task is lost.
scheduleOnMembers in interface IScheduledExecutorServicecommand - the task to executemembers - the collections of members - where to execute the taskdelay - the time from now to delay executionunit - the time unit of the delay parameterget() method will return null upon completion@Nonnull public <V> Map<Member,IScheduledFuture<V>> scheduleOnMembers(@Nonnull Callable<V> command, @Nonnull Collection<Member> members, long delay, @Nonnull TimeUnit unit)
IScheduledExecutorServiceMembers given.
Note: In the event of Member leaving the cluster, for whatever reason, the task is lost.
scheduleOnMembers in interface IScheduledExecutorServicecommand - the task to executemembers - the collections of members - where to execute the taskdelay - the time from now to delay executionunit - the time unit of the delay parameterget() method will return null upon completion@Nonnull public <V> Map<Member,IScheduledFuture<V>> scheduleOnMembersAtFixedRate(@Nonnull Runnable command, @Nonnull Collection<Member> members, long initialDelay, long period, @Nonnull TimeUnit unit)
IScheduledExecutorServiceMembers given. Executions will commence after initialDelay
then initialDelay+period, then initialDelay + 2 * period,
and so on. If any execution of this task takes longer than its period,
then subsequent execution will be skipped. If any execution of the task
encounters an exception, subsequent executions are suppressed.
Otherwise, the task will only terminate via cancellation or termination
of the executor.
Note: In the event of Member leaving the cluster, for whatever reason, the task is lost.
scheduleOnMembersAtFixedRate in interface IScheduledExecutorServicecommand - the task to executemembers - the collections of members - where to execute the taskinitialDelay - the time to delay first executionperiod - the period between successive executionsunit - the time unit of the initialDelay and period parametersget() method will throw an exception upon cancellation@Nonnull public <V> IScheduledFuture<V> getScheduledFuture(@Nonnull ScheduledTaskHandler handler)
IScheduledExecutorServiceIScheduledFuture from the given handler. This is
useful in case your member node or client from which the original
scheduling happened, went down, and now you want to access the
ScheduledFuture again.getScheduledFuture in interface IScheduledExecutorServiceV - The return type of callable taskshandler - The handler of the task as found from IScheduledFuture.getHandler()IScheduledFuture from the given handler.@Nonnull public <V> Map<Member,List<IScheduledFuture<V>>> getAllScheduledFutures()
IScheduledExecutorServiceMap.getAllScheduledFutures in interface IScheduledExecutorServiceMap with Member keys and a List of IScheduledFuture
found for this scheduler.public void shutdown()
IScheduledExecutorServiceThis method does not wait for previously submitted tasks to complete execution.
shutdown in interface IScheduledExecutorServiceprotected void onInitialize()
ClientProxyonInitialize in class ClientProxyprotected ClientMessage invokeOnPartition(ClientMessage req)
protected <T> T invokeOnPartitionInterruptibly(ClientMessage clientMessage) throws InterruptedException
InterruptedExceptionprotected <T> ClientDelegatingFuture<T> invokeOnPartitionAsync(ClientMessage clientMessage, ClientMessageDecoder clientMessageDecoder)
protected <T> T invokeOnPartition(ClientMessage clientMessage, long invocationTimeoutSeconds)
protected <T> T invokeOnPartitionInterruptibly(ClientMessage clientMessage, long invocationTimeoutSeconds) throws InterruptedException
InterruptedExceptionCopyright © 2019 Hazelcast, Inc.. All rights reserved.