Class CloseContainerCommandHandler

java.lang.Object
org.apache.hadoop.ozone.container.common.statemachine.commandhandler.CloseContainerCommandHandler
All Implemented Interfaces:
CommandHandler

public class CloseContainerCommandHandler extends Object implements CommandHandler
Handler for close container command received from SCM.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CloseContainerCommandHandler(int threadPoolSize, int queueSize, String threadNamePrefix)
    Constructs a close container command handler.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the average time this function takes to run.
    org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.SCMCommandProto.Type
    Returns the command type that this command handler handles.
    int
    Returns number of times this handler has been invoked.
    int
    Returns the queued command count for this handler.
    int
    Returns the number of threads currently executing tasks in the thread pool for this handler.If the subclass does not override this method, the default implementation will return -1, indicating that the number of active threads is not applicable or not defined.
    int
    Returns the maximum number of threads allowed in the thread pool for this handler.
    long
    Returns the total time this function takes to run.
    void
    handle(SCMCommand<?> command, OzoneContainer ozoneContainer, StateContext context, SCMConnectionManager connectionManager)
    Handles a given SCM command.
    void
    Override for any command with an internal threadpool, and stop the executor when this method is invoked.

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.apache.hadoop.ozone.container.common.statemachine.commandhandler.CommandHandler

    updateCommandStatus
  • Constructor Details

    • CloseContainerCommandHandler

      public CloseContainerCommandHandler(int threadPoolSize, int queueSize, String threadNamePrefix)
      Constructs a close container command handler.
  • Method Details

    • handle

      public void handle(SCMCommand<?> command, OzoneContainer ozoneContainer, StateContext context, SCMConnectionManager connectionManager)
      Handles a given SCM command.
      Specified by:
      handle in interface CommandHandler
      Parameters:
      command - - SCM Command
      ozoneContainer - - Ozone Container.
      context - - Current Context.
      connectionManager - - The SCMs that we are talking to.
    • getCommandType

      public org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.SCMCommandProto.Type getCommandType()
      Returns the command type that this command handler handles.
      Specified by:
      getCommandType in interface CommandHandler
      Returns:
      Type
    • getInvocationCount

      public int getInvocationCount()
      Returns number of times this handler has been invoked.
      Specified by:
      getInvocationCount in interface CommandHandler
      Returns:
      int
    • getAverageRunTime

      public long getAverageRunTime()
      Returns the average time this function takes to run.
      Specified by:
      getAverageRunTime in interface CommandHandler
      Returns:
      long
    • getTotalRunTime

      public long getTotalRunTime()
      Description copied from interface: CommandHandler
      Returns the total time this function takes to run.
      Specified by:
      getTotalRunTime in interface CommandHandler
      Returns:
      long
    • getQueuedCount

      public int getQueuedCount()
      Description copied from interface: CommandHandler
      Returns the queued command count for this handler.
      Specified by:
      getQueuedCount in interface CommandHandler
      Returns:
      The number of queued commands inside this handler.
    • getThreadPoolMaxPoolSize

      public int getThreadPoolMaxPoolSize()
      Description copied from interface: CommandHandler
      Returns the maximum number of threads allowed in the thread pool for this handler. If the subclass does not override this method, the default implementation will return -1, indicating that the maximum pool size is not applicable or not defined.
      Specified by:
      getThreadPoolMaxPoolSize in interface CommandHandler
      Returns:
      The maximum number of threads allowed in the thread pool, or -1 if not applicable or not defined.
    • getThreadPoolActivePoolSize

      public int getThreadPoolActivePoolSize()
      Description copied from interface: CommandHandler
      Returns the number of threads currently executing tasks in the thread pool for this handler.If the subclass does not override this method, the default implementation will return -1, indicating that the number of active threads is not applicable or not defined.
      Specified by:
      getThreadPoolActivePoolSize in interface CommandHandler
      Returns:
      The number of threads currently executing tasks in the thread pool, or -1 if not applicable or not defined.
    • stop

      public void stop()
      Description copied from interface: CommandHandler
      Override for any command with an internal threadpool, and stop the executor when this method is invoked.
      Specified by:
      stop in interface CommandHandler