Class ProcedureInMemoryChore<TEnvironment>

java.lang.Object
org.apache.hadoop.hbase.procedure2.Procedure<TEnvironment>
org.apache.hadoop.hbase.procedure2.ProcedureInMemoryChore<TEnvironment>
All Implemented Interfaces:
Comparable<Procedure<TEnvironment>>
Direct Known Subclasses:
AssignmentManager.DeadServerMetricRegionChore, AssignmentManager.RegionInTransitionChore, CompletedProcedureCleaner

@Private @Evolving public abstract class ProcedureInMemoryChore<TEnvironment> extends Procedure<TEnvironment>
Special procedure used as a chore. Instead of bringing the Chore class in (dependencies reason), we reuse the executor timeout thread for this special case. The assumption is that procedure is used as hook to dispatch other procedures or trigger some cleanups. It does not store state in the ProcedureStore. this is just for in-memory chore executions.
  • Constructor Details

  • Method Details

    • periodicExecute

      protected abstract void periodicExecute(TEnvironment env)
    • execute

      Description copied from class: Procedure
      The main code of the procedure. It must be idempotent since execute() may be called multiple times in case of machine failure in the middle of the execution.
      Specified by:
      execute in class Procedure<TEnvironment>
      Parameters:
      env - the environment passed to the ProcedureExecutor
      Returns:
      a set of sub-procedures to run or ourselves if there is more work to do or null if the procedure is done.
    • rollback

      protected void rollback(TEnvironment env)
      Description copied from class: Procedure
      The code to undo what was done by the execute() code. It is called when the procedure or one of the sub-procedures failed or an abort was requested. It should cleanup all the resources created by the execute() call. The implementation must be idempotent since rollback() may be called multiple time in case of machine failure in the middle of the execution.
      Specified by:
      rollback in class Procedure<TEnvironment>
      Parameters:
      env - the environment passed to the ProcedureExecutor
    • abort

      protected boolean abort(TEnvironment env)
      Description copied from class: Procedure
      The abort() call is asynchronous and each procedure must decide how to deal with it, if they want to be abortable. The simplest implementation is to have an AtomicBoolean set in the abort() method and then the execute() will check if the abort flag is set or not. abort() may be called multiple times from the client, so the implementation must be idempotent.

      NOTE: abort() is not like Thread.interrupt(). It is just a notification that allows the procedure implementor abort.

      Specified by:
      abort in class Procedure<TEnvironment>
    • serializeStateData

      protected void serializeStateData(ProcedureStateSerializer serializer) throws IOException
      Description copied from class: Procedure
      The user-level code of the procedure may have some state to persist (e.g. input arguments or current position in the processing state) to be able to resume on failure.
      Specified by:
      serializeStateData in class Procedure<TEnvironment>
      Parameters:
      serializer - stores the serializable state
      Throws:
      IOException
    • deserializeStateData

      protected void deserializeStateData(ProcedureStateSerializer serializer) throws IOException
      Description copied from class: Procedure
      Called on store load to allow the user to decode the previously serialized state.
      Specified by:
      deserializeStateData in class Procedure<TEnvironment>
      Parameters:
      serializer - contains the serialized state
      Throws:
      IOException