public class CommitProcessor extends ZooKeeperCriticalThread implements RequestProcessor
Thread.State, Thread.UncaughtExceptionHandler
RequestProcessor.RequestProcessorException
Modifier and Type | Field and Description |
---|---|
protected LinkedBlockingQueue<Request> |
committedRequests
Requests that have been committed.
|
protected AtomicInteger |
numRequestsProcessing
The number of requests currently being processed
|
protected Map<Long,Deque<Request>> |
pendingRequests
Requests that we are holding until commit comes in.
|
protected LinkedBlockingQueue<Request> |
queuedRequests
Incoming requests.
|
protected LinkedBlockingQueue<Request> |
queuedWriteRequests
Incoming requests that are waiting on a commit,
contained in order of arrival
|
protected boolean |
stopped |
protected boolean |
stoppedMainLoop
For testing purposes, we use a separated stopping condition for the
outer loop.
|
protected WorkerService |
workerPool |
static String |
ZOOKEEPER_COMMIT_PROC_MAX_COMMIT_BATCH_SIZE
Default max commit batch size: 1
|
static String |
ZOOKEEPER_COMMIT_PROC_MAX_READ_BATCH_SIZE
Default max read batch size: -1 to disable the feature
|
static String |
ZOOKEEPER_COMMIT_PROC_NUM_WORKER_THREADS
Default: numCores
|
static String |
ZOOKEEPER_COMMIT_PROC_SHUTDOWN_TIMEOUT
Default worker pool shutdown timeout in ms: 5000 (5s)
|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
CommitProcessor(RequestProcessor nextProcessor,
String id,
boolean matchSyncs,
ZooKeeperServerListener listener) |
Modifier and Type | Method and Description |
---|---|
void |
commit(Request request) |
protected void |
endOfIteration() |
static int |
getMaxCommitBatchSize() |
static int |
getMaxReadBatchSize() |
protected boolean |
needCommit(Request request) |
void |
processRequest(Request request) |
void |
run() |
static void |
setMaxCommitBatchSize(int size) |
static void |
setMaxReadBatchSize(int size) |
void |
shutdown() |
void |
start() |
protected void |
waitForEmptyPool() |
handleException
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield
public static final String ZOOKEEPER_COMMIT_PROC_NUM_WORKER_THREADS
public static final String ZOOKEEPER_COMMIT_PROC_SHUTDOWN_TIMEOUT
public static final String ZOOKEEPER_COMMIT_PROC_MAX_READ_BATCH_SIZE
public static final String ZOOKEEPER_COMMIT_PROC_MAX_COMMIT_BATCH_SIZE
protected LinkedBlockingQueue<Request> queuedRequests
protected final LinkedBlockingQueue<Request> queuedWriteRequests
protected final LinkedBlockingQueue<Request> committedRequests
protected final Map<Long,Deque<Request>> pendingRequests
protected final AtomicInteger numRequestsProcessing
protected volatile boolean stoppedMainLoop
protected volatile boolean stopped
protected WorkerService workerPool
public CommitProcessor(RequestProcessor nextProcessor, String id, boolean matchSyncs, ZooKeeperServerListener listener)
protected boolean needCommit(Request request)
protected void endOfIteration()
protected void waitForEmptyPool() throws InterruptedException
InterruptedException
public static int getMaxReadBatchSize()
public static int getMaxCommitBatchSize()
public static void setMaxReadBatchSize(int size)
public static void setMaxCommitBatchSize(int size)
public void commit(Request request)
public void processRequest(Request request)
processRequest
in interface RequestProcessor
public void shutdown()
shutdown
in interface RequestProcessor
Copyright © 2008–2022 The Apache Software Foundation. All rights reserved.