@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 Subprocedure
s.
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
Currently only one procedure with the same type and name is allowed to run at a time.
|
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
IOException
public 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)
procName
- name of the procedure to startprocArgs
- arguments for the procedureexpectedMembers
- expected members to startpublic Procedure getProcedure(String name)
name
- Name of the procedureCopyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.