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()
PartitionAware
getPartitionKey
in interface PartitionAware
public String getName()
NamedTask
DuplicateTaskException
will be thrown and the task will be rejected.public void save(Map snapshot)
StatefulTask
Runnable.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 StatefulTask
snapshot
- The Map
responsible for holding a snapshot of the current state.public void load(Map snapshot)
StatefulTask
Runnable.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 StatefulTask
snapshot
- The Map
responsible for providing a snapshot of the task's state.public void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
out
- outputIOException
public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
in
- inputIOException
public int getFactoryId()
IdentifiedDataSerializable
getFactoryId
in interface IdentifiedDataSerializable
public int getId()
IdentifiedDataSerializable
getId
in interface IdentifiedDataSerializable
Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.