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.
|
IScheduledFuture<?> |
schedule(Runnable command,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the given delay.
|
IScheduledFuture<?> |
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
Member s. |
Map<Member,IScheduledFuture<?>> |
scheduleOnAllMembers(Runnable command,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the given delay on all cluster
Member s. |
Map<Member,IScheduledFuture<?>> |
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
Member s. |
<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.
|
IScheduledFuture<?> |
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.
|
IScheduledFuture<?> |
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 . |
IScheduledFuture<?> |
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 . |
IScheduledFuture<?> |
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
Member s given. |
Map<Member,IScheduledFuture<?>> |
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
Member s given. |
Map<Member,IScheduledFuture<?>> |
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
Member s 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, getConnectedServerVersion, getContext, getDistributedObjectName, getId, getName, getPartitionKey, getSerializationService, getServiceName, hashCode, invoke, invoke, invokeOnAddress, invokeOnPartition, invokeOnPartitionInterruptibly, onDestroy, onShutdown, postDestroy, preDestroy, registerListener, setContext, toData, toObject
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
destroy, getName, getPartitionKey, getServiceName
public ClientScheduledExecutorProxy(String serviceName, String objectId, ClientContext context)
public IScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
IScheduledExecutorService
schedule
in interface IScheduledExecutorService
command
- the task to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameterget()
method will return null
upon completionpublic <V> IScheduledFuture<V> schedule(Callable<V> command, long delay, TimeUnit unit)
IScheduledExecutorService
schedule
in interface IScheduledExecutorService
command
- the task to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameterget()
method will return null
upon completionpublic IScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
IScheduledExecutorService
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.scheduleAtFixedRate
in interface IScheduledExecutorService
command
- 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 cancellationpublic IScheduledFuture<?> scheduleOnMember(Runnable command, Member member, long delay, TimeUnit unit)
IScheduledExecutorService
Member
.scheduleOnMember
in interface IScheduledExecutorService
command
- 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 completionpublic <V> IScheduledFuture<V> scheduleOnMember(Callable<V> command, Member member, long delay, TimeUnit unit)
IScheduledExecutorService
Member
.scheduleOnMember
in interface IScheduledExecutorService
command
- 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 completionpublic IScheduledFuture<?> scheduleOnMemberAtFixedRate(Runnable command, Member member, long initialDelay, long period, TimeUnit unit)
IScheduledExecutorService
Member
. 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 IScheduledExecutorService
command
- 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 cancellationpublic IScheduledFuture<?> scheduleOnKeyOwner(Runnable command, Object key, long delay, TimeUnit unit)
IScheduledExecutorService
scheduleOnKeyOwner
in interface IScheduledExecutorService
command
- 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 completionpublic <V> IScheduledFuture<V> scheduleOnKeyOwner(Callable<V> command, Object key, long delay, TimeUnit unit)
IScheduledExecutorService
scheduleOnKeyOwner
in interface IScheduledExecutorService
command
- 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 completionpublic IScheduledFuture<?> scheduleOnKeyOwnerAtFixedRate(Runnable command, Object key, long initialDelay, long period, TimeUnit unit)
IScheduledExecutorService
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.scheduleOnKeyOwnerAtFixedRate
in interface IScheduledExecutorService
command
- 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 cancellationpublic Map<Member,IScheduledFuture<?>> scheduleOnAllMembers(Runnable command, long delay, TimeUnit unit)
IScheduledExecutorService
Member
s.
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 IScheduledExecutorService
command
- the task to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameterget()
method will return null
upon completionpublic <V> Map<Member,IScheduledFuture<V>> scheduleOnAllMembers(Callable<V> command, long delay, TimeUnit unit)
IScheduledExecutorService
Member
s.
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 IScheduledExecutorService
command
- the task to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameterget()
method will return null
upon completionpublic Map<Member,IScheduledFuture<?>> scheduleOnAllMembersAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
IScheduledExecutorService
Member
s. 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 IScheduledExecutorService
command
- 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 cancellationpublic Map<Member,IScheduledFuture<?>> scheduleOnMembers(Runnable command, Collection<Member> members, long delay, TimeUnit unit)
IScheduledExecutorService
Member
s given.
Note: In the event of Member leaving the cluster, for whatever reason, the task is lost.
scheduleOnMembers
in interface IScheduledExecutorService
command
- 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 completionpublic <V> Map<Member,IScheduledFuture<V>> scheduleOnMembers(Callable<V> command, Collection<Member> members, long delay, TimeUnit unit)
IScheduledExecutorService
Member
s given.
Note: In the event of Member leaving the cluster, for whatever reason, the task is lost.
scheduleOnMembers
in interface IScheduledExecutorService
command
- 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 completionpublic Map<Member,IScheduledFuture<?>> scheduleOnMembersAtFixedRate(Runnable command, Collection<Member> members, long initialDelay, long period, TimeUnit unit)
IScheduledExecutorService
Member
s 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 IScheduledExecutorService
command
- 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 cancellationpublic <V> IScheduledFuture<V> getScheduledFuture(ScheduledTaskHandler handler)
IScheduledExecutorService
IScheduledFuture
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 IScheduledExecutorService
V
- The return type of callable taskshandler
- The handler of the task as found from IScheduledFuture.getHandler()
IScheduledFuture
from the given handler.public <V> Map<Member,List<IScheduledFuture<V>>> getAllScheduledFutures()
IScheduledExecutorService
Map
.getAllScheduledFutures
in interface IScheduledExecutorService
Map
with Member
keys and a List of IScheduledFuture
found for this scheduler.public void shutdown()
IScheduledExecutorService
This method does not wait for previously submitted tasks to complete execution.
shutdown
in interface IScheduledExecutorService
protected void onInitialize()
ClientProxy
onInitialize
in class ClientProxy
protected ClientMessage invokeOnPartition(ClientMessage req)
protected <T> T invokeOnPartitionInterruptibly(ClientMessage clientMessage) throws InterruptedException
InterruptedException
protected <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
InterruptedException
Copyright © 2019 Hazelcast, Inc.. All Rights Reserved.