org.apache.hadoop.hbase.procedure
Class ProcedureCoordinator

java.lang.Object
  extended by org.apache.hadoop.hbase.procedure.ProcedureCoordinator

@InterfaceAudience.Private
public class ProcedureCoordinator
extends Object

This is the master side of a distributed complex procedure execution.

The Procedure is generic and subclassing or customization shouldn't be necessary -- any customization should happen just in Subprocedures.


Constructor Summary
ProcedureCoordinator(ProcedureCoordinatorRpcs rpcs, ThreadPoolExecutor pool)
          Create and start a ProcedureCoordinator.
ProcedureCoordinator(ProcedureCoordinatorRpcs rpcs, ThreadPoolExecutor pool, long timeoutMillis, long wakeTimeMillis)
          Create and start a ProcedureCoordinator.
 
Method Summary
 void abortProcedure(String procName, ForeignException reason)
          Abort the procedure with the given name
 void close()
          Shutdown the thread pools and release rpc resources
static ThreadPoolExecutor defaultPool(String coordName, int opThreads)
          Default thread pool for the procedure
static ThreadPoolExecutor defaultPool(String coordName, int opThreads, long keepAliveMillis)
          Default thread pool for the procedure
 Procedure getProcedure(String name)
          Returns the procedure.
 Set<String> getProcedureNames()
           
 Procedure startProcedure(ForeignExceptionDispatcher fed, String procName, byte[] procArgs, List<String> expectedMembers)
          Kick off the named procedure
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProcedureCoordinator

public ProcedureCoordinator(ProcedureCoordinatorRpcs rpcs,
                            ThreadPoolExecutor pool)
Create and start a ProcedureCoordinator. The rpc object registers the ProcedureCoordinator and starts any threads in this constructor.

Parameters:
rpcs -
pool - Used for executing procedures.

ProcedureCoordinator

public ProcedureCoordinator(ProcedureCoordinatorRpcs rpcs,
                            ThreadPoolExecutor pool,
                            long timeoutMillis,
                            long wakeTimeMillis)
Create and start a ProcedureCoordinator. The rpc object registers the ProcedureCoordinator and starts any threads in this constructor.

Parameters:
rpcs -
pool - Used for executing procedures.
timeoutMillis -
Method Detail

defaultPool

public static ThreadPoolExecutor defaultPool(String coordName,
                                             int opThreads)
Default thread pool for the procedure

Parameters:
coordName -
opThreads - the maximum number of threads to allow in the pool

defaultPool

public static ThreadPoolExecutor defaultPool(String coordName,
                                             int opThreads,
                                             long keepAliveMillis)
Default thread pool for the procedure

Parameters:
coordName -
opThreads - the maximum number of threads to allow in the pool
keepAliveMillis - the maximum time (ms) that excess idle threads will wait for new tasks

close

public void close()
           throws IOException
Shutdown the thread pools and release rpc resources

Throws:
IOException

abortProcedure

public void abortProcedure(String procName,
                           ForeignException reason)
Abort the procedure with the given name

Parameters:
procName - name of the procedure to abort
reason - serialized information about the abort

startProcedure

public Procedure startProcedure(ForeignExceptionDispatcher fed,
                                String procName,
                                byte[] procArgs,
                                List<String> expectedMembers)
                         throws RejectedExecutionException
Kick off the named procedure

Parameters:
procName - name of the procedure to start
procArgs - arguments for the procedure
expectedMembers - expected members to start
Returns:
handle to the running procedure, if it was started correctly, null otherwise
Throws:
RejectedExecutionException - if there are no more available threads to run the procedure

getProcedure

public Procedure getProcedure(String name)
Returns the procedure. This Procedure is a live instance so should not be modified but can be inspected.

Parameters:
name - Name of the procedure
Returns:
Procedure or null if not present any more

getProcedureNames

public Set<String> getProcedureNames()
Returns:
Return set of all procedure names.


Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.