@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.Modifier and Type | Field and Description |
---|---|
private SubprocedureFactory |
builder |
(package private) static long |
KEEP_ALIVE_MILLIS_DEFAULT |
private static org.slf4j.Logger |
LOG |
private ExecutorService |
pool |
private ProcedureMemberRpcs |
rpcs |
private ConcurrentMap<String,Subprocedure> |
subprocs |
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.
|
(package private) boolean |
closeAndWait(long timeoutMs)
Shutdown the threadpool, and wait for upto timeoutMs millis before bailing
|
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) nnn
|
static ThreadPoolExecutor |
defaultPool(String memberName,
int procThreads)
Default thread pool for the procedure n * @param procThreads the maximum number of threads to
allow in the pool
|
static ThreadPoolExecutor |
defaultPool(String memberName,
int procThreads,
long keepAliveMillis)
Default thread pool for the procedure n * @param procThreads the maximum number of threads to
allow in the pool
|
(package private) ProcedureMemberRpcs |
getRpcs()
Package exposed.
|
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.
|
private static final org.slf4j.Logger LOG
static final long KEEP_ALIVE_MILLIS_DEFAULT
private final SubprocedureFactory builder
private final ProcedureMemberRpcs rpcs
private final ConcurrentMap<String,Subprocedure> subprocs
private final ExecutorService pool
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)
public static ThreadPoolExecutor defaultPool(String memberName, int procThreads, long keepAliveMillis)
keepAliveMillis
- the maximum time (ms) that excess idle threads will wait for new tasksProcedureMemberRpcs getRpcs()
public Subprocedure createSubprocedure(String opName, byte[] 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
boolean closeAndWait(long timeoutMs) throws InterruptedException
timeoutMs
- timeout limit in millisInterruptedException
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 abortCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.