|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.exist.storage.journal.FileSyncThread
Sync the current journal file by calling FileChannel.force(boolean)
.
This operation is quite expensive, so we delegate it to a background thread. The main
logging thread can continue to write into the log buffer and does not need to wait until
the force operation returns.
However, we have to make sure that only one sync operation is running at a time. So if
the main logging thread triggers another sync while one is already in progress, it has to
wait until the sync operation has finished.
Field Summary |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
FileSyncThread(java.lang.Object latch)
Create a new FileSyncThread, using the specified latch to synchronize on. |
Method Summary | |
void |
closeChannel()
Close the underlying channel. |
void |
run()
Wait for a sync event or shutdown. |
void |
setChannel(java.nio.channels.FileChannel channel)
Set the channel opened on the current journal file. |
void |
shutdown()
Shutdown the sync thread. |
void |
triggerSync()
Trigger a sync on the journal. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public FileSyncThread(java.lang.Object latch)
latch
- Method Detail |
public void setChannel(java.nio.channels.FileChannel channel)
Journal
when it switches to
a new file.
channel
- public void triggerSync()
public void shutdown()
public void closeChannel()
public void run()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |