@InterfaceAudience.Private public class ProcedureCoordinator extends Object
The Procedure is generic and subclassing or customization shouldn't be
necessary -- any customization should happen just in Subprocedures.
| Constructor and Description |
|---|
ProcedureCoordinator(ProcedureCoordinatorRpcs rpcs,
ThreadPoolExecutor pool)
Create and start a ProcedureCoordinator.
|
ProcedureCoordinator(ProcedureCoordinatorRpcs rpcs,
ThreadPoolExecutor pool,
long timeoutMillis,
long wakeTimeMillis)
Create and start a ProcedureCoordinator.
|
| Modifier and Type | Method and Description |
|---|---|
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
|
public ProcedureCoordinator(ProcedureCoordinatorRpcs rpcs, ThreadPoolExecutor pool)
rpcs - pool - Used for executing procedures.public ProcedureCoordinator(ProcedureCoordinatorRpcs rpcs, ThreadPoolExecutor pool, long timeoutMillis, long wakeTimeMillis)
rpcs - pool - Used for executing procedures.timeoutMillis - public static ThreadPoolExecutor defaultPool(String coordName, int opThreads)
coordName - opThreads - the maximum number of threads to allow in the poolpublic static ThreadPoolExecutor defaultPool(String coordName, int opThreads, long keepAliveMillis)
coordName - opThreads - the maximum number of threads to allow in the poolkeepAliveMillis - the maximum time (ms) that excess idle threads will wait for new taskspublic void close()
throws IOException
IOExceptionpublic void abortProcedure(String procName, ForeignException reason)
procName - name of the procedure to abortreason - serialized information about the abortpublic Procedure startProcedure(ForeignExceptionDispatcher fed, String procName, byte[] procArgs, List<String> expectedMembers) throws RejectedExecutionException
procName - name of the procedure to startprocArgs - arguments for the procedureexpectedMembers - expected members to startRejectedExecutionException - if there are no more available threads to run the procedurepublic Procedure getProcedure(String name)
name - Name of the procedureCopyright © 2014 The Apache Software Foundation. All rights reserved.