Class ProcedureMember

java.lang.Object
org.apache.hadoop.hbase.procedure.ProcedureMember
All Implemented Interfaces:
Closeable, AutoCloseable

@Private public class ProcedureMember extends Object implements Closeable
Process to kick off and manage a running Subprocedure on a member. This is the specialized part of a Procedure that actually does procedure type-specific work and reports back to the coordinator as it completes each phase.
  • Field Details

  • Constructor Details

    • ProcedureMember

      Instantiate a new ProcedureMember. This is a slave that executes subprocedures.
      Parameters:
      rpcs - controller used to send notifications to the procedure coordinator
      pool - thread pool to submit subprocedures
      factory - class that creates instances of a subprocedure.
  • Method Details

    • defaultPool

      public static ThreadPoolExecutor defaultPool(String memberName, int procThreads)
      Default thread pool for the procedure
      Parameters:
      procThreads - the maximum number of threads to allow in the pool
    • defaultPool

      public static ThreadPoolExecutor defaultPool(String memberName, int procThreads, long keepAliveMillis)
      Default thread pool for the procedure
      Parameters:
      procThreads - the maximum number of threads to allow in the pool
      keepAliveMillis - the maximum time (ms) that excess idle threads will wait for new tasks
    • getRpcs

      Package exposed. Not for public use.
      Returns:
      reference to the Procedure member's rpcs object
    • createSubprocedure

      public Subprocedure createSubprocedure(String opName, byte[] data)
      This is separated from execution so that we can detect and handle the case where the subprocedure is invalid and inactionable due to bad info (like DISABLED snapshot type being sent here)
    • submitSubprocedure

      public boolean submitSubprocedure(Subprocedure subproc)
      Submit an subprocedure for execution. This starts the local acquire phase.
      Parameters:
      subproc - the subprocedure to execute.
      Returns:
      true if the subprocedure was started correctly, false if it could not be started. In the latter case, the subprocedure holds a reference to the exception that caused the failure.
    • receivedReachedGlobalBarrier

      public void receivedReachedGlobalBarrier(String procName)
      Notification that procedure coordinator has reached the global barrier
      Parameters:
      procName - name of the subprocedure that should start running the in-barrier phase
    • close

      public void close() throws IOException
      Best effort attempt to close the threadpool via Thread.interrupt.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • closeAndWait

      boolean closeAndWait(long timeoutMs) throws InterruptedException
      Shutdown the threadpool, and wait for upto timeoutMs millis before bailing
      Parameters:
      timeoutMs - timeout limit in millis
      Returns:
      true if successfully, false if bailed due to timeout.
      Throws:
      InterruptedException
    • controllerConnectionFailure

      public void controllerConnectionFailure(String message, Throwable cause, String procName)
      The connection to the rest of the procedure group (member and coordinator) has been broken/lost/failed. This should fail any interested subprocedure, but not attempt to notify other members since we cannot reach them anymore.
      Parameters:
      message - description of the error
      cause - the actual cause of the failure
      procName - the name of the procedure we'd cancel due to the error.
    • receiveAbortProcedure

      public void receiveAbortProcedure(String procName, ForeignException ee)
      Send abort to the specified procedure
      Parameters:
      procName - name of the procedure to about
      ee - exception information about the abort