Class AbstractReplicationTask
java.lang.Object
org.apache.hadoop.ozone.container.replication.AbstractReplicationTask
- Direct Known Subclasses:
ECReconstructionCoordinatorTask,ReconcileContainerTask,ReplicationTask
Abstract class to capture common variables and methods for different types
of replication tasks.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumENUM representing the different status values a replication task can have. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractReplicationTask(long containerID, long deadlineMsSinceEpoch, long term) protectedAbstractReplicationTask(long containerID, long deadlineMsSinceEpoch, long term, Clock clock) -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectHook for subclasses to provide info about the command.longlongReturns any deadline set on this task, in milliseconds since the epoch.protected abstract Stringprotected abstract Stringorg.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ReplicationCommandPriorityReturns the priority of the task.longgetTerm()abstract voidrunTask()Abstract method which needs to be overridden by the sub classes to execute the task.voidsetPriority(org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ReplicationCommandPriority priority) Set the relative priority of a task.protected voidsetShouldOnlyRunOnInServiceDatanodes(boolean runOnInServiceOnly) Set whether the task should only run on in service datanodes.protected voidsetStatus(AbstractReplicationTask.Status newStatus) booleanReturns true if the task should only run on in service datanodes.toString()
-
Constructor Details
-
AbstractReplicationTask
protected AbstractReplicationTask(long containerID, long deadlineMsSinceEpoch, long term) -
AbstractReplicationTask
protected AbstractReplicationTask(long containerID, long deadlineMsSinceEpoch, long term, Clock clock)
-
-
Method Details
-
getMetricName
-
getMetricDescriptionSegment
-
getContainerId
public long getContainerId() -
getStatus
-
setStatus
-
getQueued
-
getTerm
public long getTerm() -
getDeadline
public long getDeadline()Returns any deadline set on this task, in milliseconds since the epoch. A returned value of zero indicates no deadline. -
runTask
public abstract void runTask()Abstract method which needs to be overridden by the sub classes to execute the task. -
setPriority
public void setPriority(org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ReplicationCommandPriority priority) Set the relative priority of a task. Internally Tasks use the integer value associated with the ENUM parameter. An ENUM with a lower integer value will be sorted earlier in the queue than a larger value.- Parameters:
priority- ENUM representing an integer indicating the priority of this task.
-
getPriority
public org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ReplicationCommandPriority getPriority()Returns the priority of the task. A lower number indicates a higher priority. -
shouldOnlyRunOnInServiceDatanodes
public boolean shouldOnlyRunOnInServiceDatanodes()Returns true if the task should only run on in service datanodes. False otherwise. -
setShouldOnlyRunOnInServiceDatanodes
protected void setShouldOnlyRunOnInServiceDatanodes(boolean runOnInServiceOnly) Set whether the task should only run on in service datanodes. Passing false allows the task to run on out of service datanodes as well.- Parameters:
runOnInServiceOnly-
-
getCommandForDebug
Hook for subclasses to provide info about the command.- Returns:
- string representation of the command
-
toString
-