private class FSHLog.SyncRunner extends Thread
When the sync completes, it marks all the passed in futures done. On the other end of the sync future is a blocked thread, usually a regionserver Handler. There may be more than one future passed in the case where a few threads arrive at about the same time and all invoke 'sync'. In this case we'll batch up the invocations and run one filesystem sync only for a batch of Handler sync invocations. Do not confuse these Handler SyncFutures with the futures an ExecutorService returns when you call submit. We have no use for these in this model. These SyncFutures are 'artificial', something to hold the Handler until the filesystem sync completes.
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
private boolean |
shutDown |
private BlockingQueue<FSHLog.SyncRequest> |
syncRequests |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
SyncRunner(String name,
int maxHandlersCount) |
Modifier and Type | Method and Description |
---|---|
private void |
clearSyncRequestsWhenShutDown() |
private void |
completeExceptionallySyncRequests(FSHLog.SyncRequest syncRequest,
Exception exception) |
private void |
completeSyncRequests(FSHLog.SyncRequest syncRequest,
long syncedSequenceId) |
(package private) boolean |
offer(FSHLog.SyncRequest syncRequest) |
void |
run() |
(package private) void |
shutDown() |
private FSHLog.SyncRequest |
takeSyncRequest() |
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, start, stop, stop, suspend, toString, yield
private final BlockingQueue<FSHLog.SyncRequest> syncRequests
private volatile boolean shutDown
SyncRunner(String name, int maxHandlersCount)
boolean offer(FSHLog.SyncRequest syncRequest)
private void completeSyncRequests(FSHLog.SyncRequest syncRequest, long syncedSequenceId)
private void completeExceptionallySyncRequests(FSHLog.SyncRequest syncRequest, Exception exception)
private FSHLog.SyncRequest takeSyncRequest() throws InterruptedException
InterruptedException
private void clearSyncRequestsWhenShutDown()
void shutDown()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.