com.hazelcast.client.proxy

## Class ClientScheduledExecutorProxy

- java.lang.Object
- - com.hazelcast.client.spi.ClientProxy
  - - com.hazelcast.client.proxy.ClientScheduledExecutorProxy

- All Implemented Interfaces:
    DistributedObject, IScheduledExecutorService

      public class ClientScheduledExecutorProxy
      extends ClientProxy
      implements IScheduledExecutorService

  Client proxy implementation of `IScheduledExecutorService`.

- - ### Field Summary

    - ### Fields inherited from class com.hazelcast.client.spi.ClientProxy

      `name`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientScheduledExecutorProxy(String serviceName, String objectId, ClientContext context)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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 com.hazelcast.client.impl.protocol.ClientMessage` | `invokeOnPartition(com.hazelcast.client.impl.protocol.ClientMessage req)`
    `protected <T> T` | `invokeOnPartition(com.hazelcast.client.impl.protocol.ClientMessage clientMessage, long invocationTimeoutSeconds)`
    `protected <T> ClientDelegatingFuture<T>` | `invokeOnPartitionAsync(com.hazelcast.client.impl.protocol.ClientMessage clientMessage, com.hazelcast.client.impl.ClientMessageDecoder clientMessageDecoder)`
    `protected <T> T` | `invokeOnPartitionInterruptibly(com.hazelcast.client.impl.protocol.ClientMessage clientMessage)`
    `protected <T> T` | `invokeOnPartitionInterruptibly(com.hazelcast.client.impl.protocol.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()`

    - ### Methods inherited from class com.hazelcast.client.spi.ClientProxy

      `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`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.hazelcast.core.DistributedObject

      `destroy, getName, getPartitionKey, getServiceName`

- - ### Constructor Detail

    - #### ClientScheduledExecutorProxy

          public ClientScheduledExecutorProxy(String serviceName,
                                              String objectId,
                                              ClientContext context)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### schedule

          public IScheduledFuture<?> schedule(Runnable command,
                                              long delay,
                                              TimeUnit unit)

      Description copied from interface: `IScheduledExecutorService`
      Creates and executes a one-shot action that becomes enabled after the given delay.
      Specified by:
        `schedule` in interface `IScheduledExecutorService`
      Parameters:
        `command` - the task to execute
        `delay` - the time from now to delay execution
        `unit` - the time unit of the delay parameter
      Returns:
        a ScheduledFuture representing pending completion of the task and whose `get()` method will return `null` upon completion

    - #### schedule

          public <V> IScheduledFuture<V> schedule(Callable<V> command,
                                                  long delay,
                                                  TimeUnit unit)

      Description copied from interface: `IScheduledExecutorService`
      Creates and executes a one-shot action that becomes enabled after the given delay.
      Specified by:
        `schedule` in interface `IScheduledExecutorService`
      Parameters:
        `command` - the task to execute
        `delay` - the time from now to delay execution
        `unit` - the time unit of the delay parameter
      Returns:
        a ScheduledFuture representing pending completion of the task and whose `get()` method will return `null` upon completion

    - #### scheduleAtFixedRate

          public IScheduledFuture<?> scheduleAtFixedRate(Runnable command,
                                                         long initialDelay,
                                                         long period,
                                                         TimeUnit unit)

      Description copied from interface: `IScheduledExecutorService`
      Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period. 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.
      Specified by:
        `scheduleAtFixedRate` in interface `IScheduledExecutorService`
      Parameters:
        `command` - the task to execute
        `initialDelay` - the time to delay first execution
        `period` - the period between successive executions
        `unit` - the time unit of the initialDelay and period parameters
      Returns:
        a ScheduledFuture representing pending completion of the task, and whose `get()` method will throw an exception upon cancellation

    - #### scheduleOnMember

          public IScheduledFuture<?> scheduleOnMember(Runnable command,
                                                      Member member,
                                                      long delay,
                                                      TimeUnit unit)

      Description copied from interface: `IScheduledExecutorService`
      Creates and executes a one-shot action that becomes enabled after the given delay at the given `Member`.
      Specified by:
        `scheduleOnMember` in interface `IScheduledExecutorService`
      Parameters:
        `command` - the task to execute
        `member` - the member to execute the task
        `delay` - the time from now to delay execution
        `unit` - the time unit of the delay parameter
      Returns:
        a ScheduledFuture representing pending completion of the task and whose `get()` method will return `null` upon completion

    - #### scheduleOnMember

          public <V> IScheduledFuture<V> scheduleOnMember(Callable<V> command,
                                                          Member member,
                                                          long delay,
                                                          TimeUnit unit)

      Description copied from interface: `IScheduledExecutorService`
      Creates and executes a one-shot action that becomes enabled after the given delay at the given `Member`.
      Specified by:
        `scheduleOnMember` in interface `IScheduledExecutorService`
      Parameters:
        `command` - the task to execute
        `member` - the member to execute the task
        `delay` - the time from now to delay execution
        `unit` - the time unit of the delay parameter
      Returns:
        a ScheduledFuture representing pending completion of the task and whose `get()` method will return `null` upon completion

    - #### scheduleOnMemberAtFixedRate

          public IScheduledFuture<?> scheduleOnMemberAtFixedRate(Runnable command,
                                                                 Member member,
                                                                 long initialDelay,
                                                                 long period,
                                                                 TimeUnit unit)

      Description copied from interface: `IScheduledExecutorService`
      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`. 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.
      Specified by:
        `scheduleOnMemberAtFixedRate` in interface `IScheduledExecutorService`
      Parameters:
        `command` - the task to execute
        `member` - the member to execute the task
        `initialDelay` - the time to delay first execution
        `period` - the period between successive executions
        `unit` - the time unit of the initialDelay and period parameters
      Returns:
        a ScheduledFuture representing pending completion of the task, and whose `get()` method will throw an exception upon cancellation

    - #### scheduleOnKeyOwner

          public IScheduledFuture<?> scheduleOnKeyOwner(Runnable command,
                                                        Object key,
                                                        long delay,
                                                        TimeUnit unit)

      Description copied from interface: `IScheduledExecutorService`
      Creates and executes a one-shot action that becomes enabled after the given delay on the partition owner of the given key.
      Specified by:
        `scheduleOnKeyOwner` in interface `IScheduledExecutorService`
      Parameters:
        `command` - the task to execute
        `key` - the key to identify the partition owner, which will execute the task
        `delay` - the time from now to delay execution
        `unit` - the time unit of the delay parameter
      Returns:
        a ScheduledFuture representing pending completion of the task and whose `get()` method will return `null` upon completion

    - #### scheduleOnKeyOwner

          public <V> IScheduledFuture<V> scheduleOnKeyOwner(Callable<V> command,
                                                            Object key,
                                                            long delay,
                                                            TimeUnit unit)

      Description copied from interface: `IScheduledExecutorService`
      Creates and executes a one-shot action that becomes enabled after the given delay on the partition owner of the given key.
      Specified by:
        `scheduleOnKeyOwner` in interface `IScheduledExecutorService`
      Parameters:
        `command` - the task to execute
        `key` - the key to identify the partition owner, which will execute the task
        `delay` - the time from now to delay execution
        `unit` - the time unit of the delay parameter
      Returns:
        a ScheduledFuture representing pending completion of the task and whose `get()` method will return `null` upon completion

    - #### scheduleOnKeyOwnerAtFixedRate

          public IScheduledFuture<?> scheduleOnKeyOwnerAtFixedRate(Runnable command,
                                                                   Object key,
                                                                   long initialDelay,
                                                                   long period,
                                                                   TimeUnit unit)

      Description copied from interface: `IScheduledExecutorService`
      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. 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.
      Specified by:
        `scheduleOnKeyOwnerAtFixedRate` in interface `IScheduledExecutorService`
      Parameters:
        `command` - the task to execute
        `key` - the key to identify the partition owner, which will execute the task
        `initialDelay` - the time to delay first execution
        `period` - the period between successive executions
        `unit` - the time unit of the initialDelay and period parameters
      Returns:
        a ScheduledFuture representing pending completion of the task, and whose `get()` method will throw an exception upon cancellation

    - #### scheduleOnAllMembers

          public Map<Member,IScheduledFuture<?>> scheduleOnAllMembers(Runnable command,
                                                                      long delay,
                                                                      TimeUnit unit)

      Description copied from interface: `IScheduledExecutorService`
      Creates and executes a one-shot action that becomes enabled after the given delay on all cluster `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.

      Specified by:
        `scheduleOnAllMembers` in interface `IScheduledExecutorService`
      Parameters:
        `command` - the task to execute
        `delay` - the time from now to delay execution
        `unit` - the time unit of the delay parameter
      Returns:
        a ScheduledFuture representing pending completion of the task and whose `get()` method will return `null` upon completion

    - #### scheduleOnAllMembers

          public <V> Map<Member,IScheduledFuture<V>> scheduleOnAllMembers(Callable<V> command,
                                                                          long delay,
                                                                          TimeUnit unit)

      Description copied from interface: `IScheduledExecutorService`
      Creates and executes a one-shot action that becomes enabled after the given delay on all cluster `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.

      Specified by:
        `scheduleOnAllMembers` in interface `IScheduledExecutorService`
      Parameters:
        `command` - the task to execute
        `delay` - the time from now to delay execution
        `unit` - the time unit of the delay parameter
      Returns:
        a ScheduledFuture representing pending completion of the task and whose `get()` method will return `null` upon completion

    - #### scheduleOnAllMembersAtFixedRate

          public Map<Member,IScheduledFuture<?>> scheduleOnAllMembersAtFixedRate(Runnable command,
                                                                                 long initialDelay,
                                                                                 long period,
                                                                                 TimeUnit unit)

      Description copied from interface: `IScheduledExecutorService`
      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. 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.

      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.

      Specified by:
        `scheduleOnAllMembersAtFixedRate` in interface `IScheduledExecutorService`
      Parameters:
        `command` - the task to execute
        `initialDelay` - the time to delay first execution
        `period` - the period between successive executions
        `unit` - the time unit of the initialDelay and period parameters
      Returns:
        a ScheduledFuture representing pending completion of the task, and whose `get()` method will throw an exception upon cancellation

    - #### scheduleOnMembers

          public Map<Member,IScheduledFuture<?>> scheduleOnMembers(Runnable command,
                                                                   Collection<Member> members,
                                                                   long delay,
                                                                   TimeUnit unit)

      Description copied from interface: `IScheduledExecutorService`
      Creates and executes a one-shot action that becomes enabled after the given delay on all `Member`s given.

      Note: In the event of Member leaving the cluster, for whatever reason, the task is lost.

      Specified by:
        `scheduleOnMembers` in interface `IScheduledExecutorService`
      Parameters:
        `command` - the task to execute
        `members` - the collections of members - where to execute the task
        `delay` - the time from now to delay execution
        `unit` - the time unit of the delay parameter
      Returns:
        a ScheduledFuture representing pending completion of the task and whose `get()` method will return `null` upon completion

    - #### scheduleOnMembers

          public <V> Map<Member,IScheduledFuture<V>> scheduleOnMembers(Callable<V> command,
                                                                       Collection<Member> members,
                                                                       long delay,
                                                                       TimeUnit unit)

      Description copied from interface: `IScheduledExecutorService`
      Creates and executes a one-shot action that becomes enabled after the given delay on all `Member`s given.

      Note: In the event of Member leaving the cluster, for whatever reason, the task is lost.

      Specified by:
        `scheduleOnMembers` in interface `IScheduledExecutorService`
      Parameters:
        `command` - the task to execute
        `members` - the collections of members - where to execute the task
        `delay` - the time from now to delay execution
        `unit` - the time unit of the delay parameter
      Returns:
        a ScheduledFuture representing pending completion of the task and whose `get()` method will return `null` upon completion

    - #### scheduleOnMembersAtFixedRate

          public Map<Member,IScheduledFuture<?>> scheduleOnMembersAtFixedRate(Runnable command,
                                                                              Collection<Member> members,
                                                                              long initialDelay,
                                                                              long period,
                                                                              TimeUnit unit)

      Description copied from interface: `IScheduledExecutorService`
      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. 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.

      Note: In the event of Member leaving the cluster, for whatever reason, the task is lost.

      Specified by:
        `scheduleOnMembersAtFixedRate` in interface `IScheduledExecutorService`
      Parameters:
        `command` - the task to execute
        `members` - the collections of members - where to execute the task
        `initialDelay` - the time to delay first execution
        `period` - the period between successive executions
        `unit` - the time unit of the initialDelay and period parameters
      Returns:
        a ScheduledFuture representing pending completion of the task, and whose `get()` method will throw an exception upon cancellation

    - #### getScheduledFuture

          public <V> IScheduledFuture<V> getScheduledFuture(ScheduledTaskHandler handler)

      Description copied from interface: `IScheduledExecutorService`
      Creates a new `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.
      Specified by:
        `getScheduledFuture` in interface `IScheduledExecutorService`
      Type Parameters:
        `V` - The return type of callable tasks
      Parameters:
        `handler` - The handler of the task as found from `IScheduledFuture.getHandler()`
      Returns:
        A new `IScheduledFuture` from the given handler.

    - #### getAllScheduledFutures

          public <V> Map<Member,List<IScheduledFuture<V>>> getAllScheduledFutures()

      Description copied from interface: `IScheduledExecutorService`
      Fetches and returns all scheduled (not disposed yet) futures from all members in the cluster. If a member has no running tasks for this scheduler, it wont be included in the returned `Map`.
      Specified by:
        `getAllScheduledFutures` in interface `IScheduledExecutorService`
      Returns:
        A `Map` with `Member` keys and a List of `IScheduledFuture` found for this scheduler.

    - #### shutdown

          public void shutdown()

      Description copied from interface: `IScheduledExecutorService`
      Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down.

      This method does not wait for previously submitted tasks to complete execution.

      Specified by:
        `shutdown` in interface `IScheduledExecutorService`

    - #### onInitialize

          protected void onInitialize()

      Description copied from class: `ClientProxy`
      Called when proxy is created. Overriding implementations can add initialization specific logic into this method like registering a listener, creating a cleanup task etc.
      Overrides:
        `onInitialize` in class `ClientProxy`

    - #### invokeOnPartition

          protected com.hazelcast.client.impl.protocol.ClientMessage invokeOnPartition(com.hazelcast.client.impl.protocol.ClientMessage req)

    - #### invokeOnPartitionInterruptibly

          protected <T> T invokeOnPartitionInterruptibly(com.hazelcast.client.impl.protocol.ClientMessage clientMessage)
                                                  throws InterruptedException

      Throws:
        `InterruptedException`

    - #### invokeOnPartitionAsync

          protected <T> ClientDelegatingFuture<T> invokeOnPartitionAsync(com.hazelcast.client.impl.protocol.ClientMessage clientMessage,
                                                                         com.hazelcast.client.impl.ClientMessageDecoder clientMessageDecoder)

    - #### invokeOnPartition

          protected <T> T invokeOnPartition(com.hazelcast.client.impl.protocol.ClientMessage clientMessage,
                                            long invocationTimeoutSeconds)

    - #### invokeOnPartitionInterruptibly

          protected <T> T invokeOnPartitionInterruptibly(com.hazelcast.client.impl.protocol.ClientMessage clientMessage,
                                                         long invocationTimeoutSeconds)
                                                  throws InterruptedException

      Throws:
        `InterruptedException`

Copyright © 2018. All rights reserved.