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 long |
sequence |
private BlockingQueue<SyncFuture> |
syncFutures |
private SyncFuture |
takeSyncFuture |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
SyncRunner(String name,
int maxHandlersCount) |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
areSyncFuturesReleased() |
(package private) void |
offer(long sequence,
SyncFuture[] syncFutures,
int syncFutureCount) |
private int |
releaseSyncFuture(SyncFuture syncFuture,
long currentSequence,
Throwable t)
Release the passed
syncFuture |
private int |
releaseSyncFutures(long currentSequence,
Throwable t)
Release all SyncFutures whose sequence is <=
currentSequence . |
void |
run() |
private long |
updateHighestSyncedSequence(long sequence) |
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 volatile long sequence
private final BlockingQueue<SyncFuture> syncFutures
private volatile SyncFuture takeSyncFuture
SyncRunner(String name, int maxHandlersCount)
void offer(long sequence, SyncFuture[] syncFutures, int syncFutureCount)
private int releaseSyncFuture(SyncFuture syncFuture, long currentSequence, Throwable t)
syncFuture
private int releaseSyncFutures(long currentSequence, Throwable t)
currentSequence
.t
- May be non-null if we are processing SyncFutures because an exception was thrown.private long updateHighestSyncedSequence(long sequence)
sequence
- The sequence we ran the filesystem sync against.boolean areSyncFuturesReleased()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.