Class AbstractReplicationTask

java.lang.Object
org.apache.hadoop.ozone.container.replication.AbstractReplicationTask
Direct Known Subclasses:
ECReconstructionCoordinatorTask, ReconcileContainerTask, ReplicationTask

public abstract class AbstractReplicationTask extends Object
Abstract class to capture common variables and methods for different types of replication tasks.
  • 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

      protected abstract String getMetricName()
    • getMetricDescriptionSegment

      protected abstract String getMetricDescriptionSegment()
    • getContainerId

      public long getContainerId()
    • getStatus

      public AbstractReplicationTask.Status getStatus()
    • setStatus

      protected void setStatus(AbstractReplicationTask.Status newStatus)
    • getQueued

      public Instant 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

      protected Object getCommandForDebug()
      Hook for subclasses to provide info about the command.
      Returns:
      string representation of the command
    • toString

      public String toString()
      Overrides:
      toString in class Object