private class FSHLog.SyncRunner extends HasThread
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.
Modifier and Type | Field and Description |
---|---|
private long |
sequence |
private BlockingQueue<SyncFuture> |
syncFutures |
private SyncFuture |
takeSyncFuture |
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) |
getName, getThread, interrupt, isAlive, isInterrupted, join, join, join, setDaemon, setName, setPriority, setUncaughtExceptionHandler, start
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–2019 The Apache Software Foundation. All rights reserved.