Class InternalProcedure<Env>

java.lang.Object
org.apache.iotdb.confignode.procedure.Procedure<Env>
org.apache.iotdb.confignode.procedure.InternalProcedure<Env>
Type Parameters:
Env -
All Implemented Interfaces:
Comparable<Procedure<Env>>
Direct Known Subclasses:
CompletedProcedureRecycler, PartitionTableAutoCleaner

public abstract class InternalProcedure<Env> extends Procedure<Env>
Internal Procedure, do some periodic job for framework.
  • Constructor Details

    • InternalProcedure

      protected InternalProcedure(long toMillis)
  • Method Details

    • periodicExecute

      protected abstract void periodicExecute(Env env)
    • execute

      protected Procedure<Env>[] execute(Env env) throws InterruptedException
      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<Env>
      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.
      Throws:
      InterruptedException - the procedure will be added back to the queue and retried later.
    • rollback

      protected void rollback(Env env) throws IOException, InterruptedException
      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<Env>
      Parameters:
      env - the environment passed to the ProcedureExecutor
      Throws:
      IOException - temporary failure, the rollback will retry later
      InterruptedException - the procedure will be added back to the queue and retried later
    • deserialize

      public void deserialize(ByteBuffer byteBuffer)
      Overrides:
      deserialize in class Procedure<Env>