com.sleepycat.je.log
Class FSyncManager

java.lang.Object
  extended by com.sleepycat.je.log.FSyncManager

 class FSyncManager
extends Object


Nested Class Summary
(package private) static class FSyncManager.FSyncGroup
           
 
Constructor Summary
FSyncManager(EnvironmentImpl envImpl)
           
 
Method Summary
protected  void executeFSync()
          Put the fsync execution into this method so it can be overridden for testing purposes.
(package private)  void fsync()
          Request that this file be fsynced to disk.
(package private)  long getNFSyncRequests()
           
(package private)  long getNFSyncs()
           
(package private)  long getNTimeouts()
           
(package private)  void loadStats(StatsConfig config, EnvironmentStats stats)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FSyncManager

FSyncManager(EnvironmentImpl envImpl)
       throws DatabaseException
Throws:
DatabaseException
Method Detail

fsync

void fsync()
     throws DatabaseException
Request that this file be fsynced to disk. This thread may or may not actually execute the fsync, but will not return until a fsync has been issued and executed on behalf of its write. There is a timeout period specified by EnvironmentParam.LOG_FSYNC_TIMEOUT that ensures that no thread gets stuck here indefinitely. When a thread comes in, it will find one of two things. 1. There is no fsync going on right now. This thread should go ahead and fsync. 2. There is an active fsync, wait until it's over before starting a new fsync. When a fsync is going on, all those threads that come along are grouped together as the nextFsyncWaiters. When the current fsync is finished, one of those nextFsyncWaiters will be selected as a leader to issue the next fsync. The other members of the group will merely wait until the fsync done on their behalf is finished. When a thread finishes a fsync, it has to: 1. wake up all the threads that were waiting for its fsync call. 2. wake up one member of the next group of waiting threads (the nextFsyncWaiters) so that thread can become the new leader and issue the next fysnc call. If a non-leader member of the nextFsyncWaiters times out, it will issue its own fsync anyway, in case something happened to the leader.

Throws:
DatabaseException

getNFSyncRequests

long getNFSyncRequests()

getNFSyncs

long getNFSyncs()

getNTimeouts

long getNTimeouts()

loadStats

void loadStats(StatsConfig config,
               EnvironmentStats stats)
         throws DatabaseException
Throws:
DatabaseException

executeFSync

protected void executeFSync()
                     throws DatabaseException
Put the fsync execution into this method so it can be overridden for testing purposes.

Throws:
DatabaseException


Copyright 2004-2005 Sleepycat, Inc. All Rights Reserved.