com.hazelcast.scheduledexecutor

## Class ScheduledTaskHandler

- java.lang.Object
- - com.hazelcast.scheduledexecutor.ScheduledTaskHandler

- All Implemented Interfaces:
    DataSerializable, IdentifiedDataSerializable

      public abstract class ScheduledTaskHandler
      extends Object
      implements IdentifiedDataSerializable

  Resource handler pointing to a `IScheduledFuture`. The handler is used to interact with the `ScheduledFuture` in a `IScheduledExecutorService`.

  To access the handler, see `IScheduledFuture.getHandler()`. To re-acquire access to a previously scheduled task, having only the handler at hand, see `IScheduledExecutorService.getScheduledFuture(ScheduledTaskHandler)`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ScheduledTaskHandler()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract Address` | `getAddress()` Returns the address of the member the task is associated with.
    `abstract int` | `getPartitionId()` Returns the partition ID the task is associated with.
    `abstract String` | `getSchedulerName()` Return the name of the ScheduledExecutor this tasks is running on.
    `abstract String` | `getTaskName()` Returns the name of the task.
    `abstract boolean` | `isAssignedToMember()`
    `abstract boolean` | `isAssignedToPartition()`
    `static ScheduledTaskHandler` | `of(String urn)` Reconstructs a `ScheduledTaskHandler` from a URN String.
    `abstract String` | `toUrn()` Returns the String representation of the handler.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.hazelcast.nio.serialization.IdentifiedDataSerializable

      `getFactoryId, getId`

    - ### Methods inherited from interface com.hazelcast.nio.serialization.DataSerializable

      `readData, writeData`

- - ### Constructor Detail

    - #### ScheduledTaskHandler

          public ScheduledTaskHandler()

  - ### Method Detail

    - #### getAddress

          public abstract Address getAddress()

      Returns the address of the member the task is associated with.

      The address will be `null`, if the task was scheduled to particular partition.

      Returns:
        The address of the member

    - #### getPartitionId

          public abstract int getPartitionId()

      Returns the partition ID the task is associated with.

      If the task was scheduled to a particular member, then the partition ID will have the value of -1.

      Returns:
        The partition ID

    - #### getSchedulerName

          public abstract String getSchedulerName()

      Return the name of the ScheduledExecutor this tasks is running on.
      Returns:
        the name of the scheduler

    - #### getTaskName

          public abstract String getTaskName()

      Returns the name of the task.
      Returns:
        the task name

    - #### isAssignedToPartition

          public abstract boolean isAssignedToPartition()

      Returns:
        `true` when the associated task was scheduled on a specific partition

    - #### isAssignedToMember

          public abstract boolean isAssignedToMember()

      Returns:
        `true` when the associated task was scheduled on a specific member in the cluster

    - #### toUrn

          public abstract String toUrn()

      Returns the String representation of the handler.

      Useful for persisting and/or communicating this info. A `ScheduledTaskHandler` can be constructed again from the Urn String using `of(String)`

      Returns:
        URN representing the handler in a String format

    - #### of

          public static ScheduledTaskHandler of(String urn)

      Reconstructs a `ScheduledTaskHandler` from a URN String.
      Parameters:
        `urn` - The URN of the handler as retrieved from `toUrn()`
      Returns:
        A `ScheduledTaskHandler` instance that can be used to access the scheduled task

Copyright © 2020. All rights reserved.