Class Procedure

java.lang.Object
org.apache.hadoop.hbase.procedure.Procedure
All Implemented Interfaces:
Callable<Void>, ForeignExceptionListener

@Private public class Procedure extends Object implements Callable<Void>, ForeignExceptionListener
A globally-barriered distributed procedure. This class encapsulates state and methods for tracking and managing a distributed procedure, as well as aborting if any member encounters a problem or if a cancellation is requested.

All procedures first attempt to reach a barrier point with the sendGlobalBarrierStart() method. The procedure contacts all members and waits for all subprocedures to execute Subprocedure.acquireBarrier() to acquire its local piece of the global barrier and then send acquisition info back to the coordinator. If all acquisitions at subprocedures succeed, the coordinator then will call sendGlobalBarrierReached(). This notifies members to execute the Subprocedure.insideBarrier() method. The procedure is blocked until all Subprocedure.insideBarrier() executions complete at the members. When Subprocedure.insideBarrier() completes at each member, the member sends notification to the coordinator. Once all members complete, the coordinator calls sendGlobalBarrierComplete().

If errors are encountered remotely, they are forwarded to the coordinator, and Subprocedure.cleanup(Exception) is called.

Each Procedure and each Subprocedure enforces a time limit on the execution time. If the time limit expires before the procedure completes the TimeoutExceptionInjector will trigger an ForeignException to abort the procedure. This is particularly useful for situations when running a distributed Subprocedure so participants can avoid blocking for extreme amounts of time if one of the participants fails or takes a really long time (e.g. GC pause).

Users should generally not directly create or subclass instances of this. They are created for them implicitly via ProcedureCoordinator.startProcedure(ForeignExceptionDispatcher, String, byte[], List)}