@InterfaceAudience.Private public class ProcedureCoordinator extends java.lang.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,
java.util.concurrent.ThreadPoolExecutor pool)
Create and start a ProcedureCoordinator.
|
ProcedureCoordinator(ProcedureCoordinatorRpcs rpcs,
java.util.concurrent.ThreadPoolExecutor pool,
long timeoutMillis,
long wakeTimeMillis)
Create and start a ProcedureCoordinator.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abortProcedure(java.lang.String procName,
ForeignException reason)
Abort the procedure with the given name
|
void |
close()
Shutdown the thread pools and release rpc resources
|
static java.util.concurrent.ThreadPoolExecutor |
defaultPool(java.lang.String coordName,
int opThreads)
Default thread pool for the procedure
|
static java.util.concurrent.ThreadPoolExecutor |
defaultPool(java.lang.String coordName,
int opThreads,
long keepAliveMillis)
Default thread pool for the procedure
|
Procedure |
getProcedure(java.lang.String name)
Returns the procedure.
|
java.util.Set<java.lang.String> |
getProcedureNames() |
Procedure |
startProcedure(ForeignExceptionDispatcher fed,
java.lang.String procName,
byte[] procArgs,
java.util.List<java.lang.String> expectedMembers)
Kick off the named procedure
Currently only one procedure with the same type and name is allowed to run at a time.
|
public ProcedureCoordinator(ProcedureCoordinatorRpcs rpcs, java.util.concurrent.ThreadPoolExecutor pool)
rpcs - pool - Used for executing procedures.public ProcedureCoordinator(ProcedureCoordinatorRpcs rpcs, java.util.concurrent.ThreadPoolExecutor pool, long timeoutMillis, long wakeTimeMillis)
rpcs - pool - Used for executing procedures.timeoutMillis - public static java.util.concurrent.ThreadPoolExecutor defaultPool(java.lang.String coordName,
int opThreads)
coordName - opThreads - the maximum number of threads to allow in the poolpublic static java.util.concurrent.ThreadPoolExecutor defaultPool(java.lang.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 java.io.IOException
java.io.IOExceptionpublic void abortProcedure(java.lang.String procName,
ForeignException reason)
procName - name of the procedure to abortreason - serialized information about the abortpublic Procedure startProcedure(ForeignExceptionDispatcher fed, java.lang.String procName, byte[] procArgs, java.util.List<java.lang.String> expectedMembers)
procName - name of the procedure to startprocArgs - arguments for the procedureexpectedMembers - expected members to startpublic Procedure getProcedure(java.lang.String name)
name - Name of the procedurepublic java.util.Set<java.lang.String> getProcedureNames()