Class ProcedureMember
java.lang.Object
org.apache.hadoop.hbase.procedure.ProcedureMember
- All Implemented Interfaces:
Closeable
,AutoCloseable
Process to kick off and manage a running
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.-
Field Summary
Modifier and TypeFieldDescriptionprivate final SubprocedureFactory
(package private) static final long
private static final org.slf4j.Logger
private final ExecutorService
private final ProcedureMemberRpcs
private final ConcurrentMap<String,
Subprocedure> -
Constructor Summary
ConstructorDescriptionProcedureMember
(ProcedureMemberRpcs rpcs, ThreadPoolExecutor pool, SubprocedureFactory factory) Instantiate a new ProcedureMember. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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 bailingvoid
controllerConnectionFailure
(String message, Throwable cause, String procName) The connection to the rest of the procedure group (member and coordinator) has been broken/lost/failed.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 procedurestatic ThreadPoolExecutor
defaultPool
(String memberName, int procThreads, long keepAliveMillis) Default thread pool for the procedure(package private) ProcedureMemberRpcs
getRpcs()
Package exposed.void
receiveAbortProcedure
(String procName, ForeignException ee) Send abort to the specified procedurevoid
receivedReachedGlobalBarrier
(String procName) Notification that procedure coordinator has reached the global barrierboolean
submitSubprocedure
(Subprocedure subproc) Submit an subprocedure for execution.
-
Field Details
-
LOG
-
KEEP_ALIVE_MILLIS_DEFAULT
- See Also:
-
builder
-
rpcs
-
subprocs
-
pool
-
-
Constructor Details
-
ProcedureMember
public ProcedureMember(ProcedureMemberRpcs rpcs, ThreadPoolExecutor pool, SubprocedureFactory factory) Instantiate a new ProcedureMember. This is a slave that executes subprocedures.- Parameters:
rpcs
- controller used to send notifications to the procedure coordinatorpool
- thread pool to submit subproceduresfactory
- class that creates instances of a subprocedure.
-
-
Method Details
-
defaultPool
Default thread pool for the procedure- Parameters:
procThreads
- the maximum number of threads to allow in the pool
-
defaultPool
public static ThreadPoolExecutor defaultPool(String memberName, int procThreads, long keepAliveMillis) Default thread pool for the procedure- Parameters:
procThreads
- the maximum number of threads to allow in the poolkeepAliveMillis
- the maximum time (ms) that excess idle threads will wait for new tasks
-
getRpcs
Package exposed. Not for public use.- Returns:
- reference to the Procedure member's rpcs object
-
createSubprocedure
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) -
submitSubprocedure
Submit an subprocedure for execution. This starts the local acquire phase.- Parameters:
subproc
- the subprocedure to execute.- Returns:
- true if the subprocedure was started correctly, false if it could not be started. In the latter case, the subprocedure holds a reference to the exception that caused the failure.
-
receivedReachedGlobalBarrier
Notification that procedure coordinator has reached the global barrier- Parameters:
procName
- name of the subprocedure that should start running the in-barrier phase
-
close
Best effort attempt to close the threadpool via Thread.interrupt.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
closeAndWait
Shutdown the threadpool, and wait for upto timeoutMs millis before bailing- Parameters:
timeoutMs
- timeout limit in millis- Returns:
- true if successfully, false if bailed due to timeout.
- Throws:
InterruptedException
-
controllerConnectionFailure
The connection to the rest of the procedure group (member and coordinator) has been broken/lost/failed. This should fail any interested subprocedure, but not attempt to notify other members since we cannot reach them anymore.- Parameters:
message
- description of the errorcause
- the actual cause of the failureprocName
- the name of the procedure we'd cancel due to the error.
-
receiveAbortProcedure
Send abort to the specified procedure- Parameters:
procName
- name of the procedure to aboutee
- exception information about the abort
-