public class ScheduledRunnableAdapter<V> extends Object implements IdentifiedDataSerializable, Callable<V>, NodeAware, PartitionAware, NamedTask, StatefulTask
| Constructor and Description |
|---|
ScheduledRunnableAdapter() |
ScheduledRunnableAdapter(Runnable task) |
| Modifier and Type | Method and Description |
|---|---|
V |
call() |
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
int |
getId()
Returns type identifier for this class.
|
String |
getName()
Returns the name of the task.
|
Object |
getPartitionKey()
The key that will be used by Hazelcast to specify the partition.
|
Runnable |
getRunnable() |
void |
load(Map snapshot)
Task callback to initialize its inner state, after a replica promotion, from the given map.
|
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
void |
save(Map snapshot)
Task callback to capture its state on the provided map.
|
void |
setNode(Node node) |
void |
setRunnable(Runnable runnable) |
String |
toString() |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
public ScheduledRunnableAdapter()
public ScheduledRunnableAdapter(Runnable task)
public Runnable getRunnable()
public void setRunnable(Runnable runnable)
public Object getPartitionKey()
PartitionAwaregetPartitionKey in interface PartitionAwarepublic String getName()
NamedTaskDuplicateTaskException will be thrown and the task will be rejected.public void save(Map snapshot)
StatefulTaskRunnable.run() or Callable.call()
to capture a snapshot of the state and publish to replicas. If two or more replicas of the
same task run at the same time and publish their states, then only the one running on the owner
member will be allowed to update the replicas.
Note: The state of the cluster is not known or guaranteed during task's execution, thus,
publication of the task's state to replicas is done on best-effort basis.
Called immediately after run() or call() of the Runnable
or Callable respectively.save in interface StatefulTasksnapshot - The Map responsible for holding a snapshot of the current state.public void load(Map snapshot)
StatefulTaskRunnable.run() or Callable.call() to setup task's state as published from
the previous owner of the task in the cluster.
load will not be called if the snapshot is empty.load in interface StatefulTasksnapshot - The Map responsible for providing a snapshot of the task's state.public void writeData(ObjectDataOutput out) throws IOException
DataSerializablewriteData in interface DataSerializableout - outputIOExceptionpublic void readData(ObjectDataInput in) throws IOException
DataSerializablereadData in interface DataSerializablein - inputIOExceptionpublic int getFactoryId()
IdentifiedDataSerializablegetFactoryId in interface IdentifiedDataSerializablepublic int getId()
IdentifiedDataSerializablegetId in interface IdentifiedDataSerializableCopyright © 2018 Hazelcast, Inc.. All Rights Reserved.