@InterfaceAudience.Private public class ProcedureMember extends Object implements Closeable
Subprocedure
on a member. This is the
specialized part of a Procedure
that actually does procedure type-specific work
and reports back to the coordinator as it completes each phase.Constructor and Description |
---|
ProcedureMember(ProcedureMemberRpcs rpcs,
ThreadPoolExecutor pool,
SubprocedureFactory factory)
Instantiate a new ProcedureMember.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Best effort attempt to close the threadpool via Thread.interrupt.
|
void |
controllerConnectionFailure(String message,
Throwable cause,
String procName)
The connection to the rest of the procedure group (member and coordinator) has been
broken/lost/failed.
|
Subprocedure |
createSubprocedure(String opName,
byte[] data)
This is separated from execution so that we can detect and handle the case where the
subprocedure is invalid and inactionable due to bad info (like DISABLED snapshot type being
sent here)
|
static ThreadPoolExecutor |
defaultPool(String memberName,
int procThreads)
Default thread pool for the procedure
|
static ThreadPoolExecutor |
defaultPool(String memberName,
int procThreads,
long keepAliveMillis)
Default thread pool for the procedure
|
void |
receiveAbortProcedure(String procName,
ForeignException ee)
Send abort to the specified procedure
|
void |
receivedReachedGlobalBarrier(String procName)
Notification that procedure coordinator has reached the global barrier
|
boolean |
submitSubprocedure(Subprocedure subproc)
Submit an subprocedure for execution.
|
public ProcedureMember(ProcedureMemberRpcs rpcs, ThreadPoolExecutor pool, SubprocedureFactory factory)
rpcs
- controller used to send notifications to the procedure coordinatorpool
- thread pool to submit subproceduresfactory
- class that creates instances of a subprocedure.public static ThreadPoolExecutor defaultPool(String memberName, int procThreads)
memberName
- procThreads
- the maximum number of threads to allow in the poolpublic static ThreadPoolExecutor defaultPool(String memberName, int procThreads, long keepAliveMillis)
memberName
- procThreads
- the maximum number of threads to allow in the poolkeepAliveMillis
- the maximum time (ms) that excess idle threads will wait for new taskspublic Subprocedure createSubprocedure(String opName, byte[] data)
opName
- data
- public boolean submitSubprocedure(Subprocedure subproc)
subproc
- the subprocedure to execute.public void receivedReachedGlobalBarrier(String procName)
procName
- name of the subprocedure that should start running the in-barrier phasepublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void controllerConnectionFailure(String message, Throwable cause, String procName)
message
- description of the errorcause
- the actual cause of the failureprocName
- the name of the procedure we'd cancel due to the error.public void receiveAbortProcedure(String procName, ForeignException ee)
procName
- name of the procedure to aboutee
- exception information about the abort