com.sleepycat.je.cleaner
Class FileProcessor

java.lang.Object
  extended by com.sleepycat.je.utilint.DaemonThread
      extended by com.sleepycat.je.cleaner.FileProcessor
All Implemented Interfaces:
DaemonRunner, ExceptionListenerUser, Runnable

 class FileProcessor
extends DaemonThread

Reads all entries in a log file and either determines them to be obsolete or marks them for migration. LNs are marked for migration by setting the BIN entry MIGRATE flag. INs are marked for migration by setting the dirty flag. May be invoked explicitly by calling doClean, or woken up if used as a daemon thread.


Field Summary
 
Fields inherited from class com.sleepycat.je.utilint.DaemonThread
envImpl, logger, name, nWakeupRequests, stifleExceptionChatter
 
Constructor Summary
FileProcessor(String name, EnvironmentImpl env, Cleaner cleaner, UtilizationProfile profile, UtilizationCalculator calculator, FileSelector fileSelector)
           
 
Method Summary
 void clearEnv()
           
 int doClean(boolean invokedFromDaemon, boolean cleanMultipleFiles, boolean forceCleaning)
          Cleans selected files and returns the number of files cleaned.
protected  long nDeadlockRetries()
          Return the number of retries when a deadlock exception occurs.
 void onWakeup()
          Activates the cleaner.
(package private)  void testProcessLN(LN targetLN, long logLsn, byte[] key, DatabaseId dbId, Map<DatabaseId,DatabaseImpl> dbCache)
          Unit testing.
 
Methods inherited from class com.sleepycat.je.utilint.DaemonThread
checkErrorListener, createLogger, getExceptionListener, getNWakeupRequests, getThread, isPaused, isRunning, isShutdownRequested, requestShutdown, run, runOrPause, setExceptionListener, shutdown, toString, wakeup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileProcessor

FileProcessor(String name,
              EnvironmentImpl env,
              Cleaner cleaner,
              UtilizationProfile profile,
              UtilizationCalculator calculator,
              FileSelector fileSelector)
Method Detail

clearEnv

public void clearEnv()

nDeadlockRetries

protected long nDeadlockRetries()
Return the number of retries when a deadlock exception occurs.

Overrides:
nDeadlockRetries in class DaemonThread

onWakeup

public void onWakeup()
              throws DatabaseException
Activates the cleaner. Is normally called when je.cleaner.byteInterval bytes are written to the log.

Specified by:
onWakeup in class DaemonThread
Throws:
DatabaseException

doClean

public int doClean(boolean invokedFromDaemon,
                   boolean cleanMultipleFiles,
                   boolean forceCleaning)
            throws DatabaseException
Cleans selected files and returns the number of files cleaned. May be called by the daemon thread or programatically.

Parameters:
invokedFromDaemon - currently has no effect.
cleanMultipleFiles - is true to clean until we're under budget, or false to clean at most one file.
forceCleaning - is true to clean even if we're not under the utilization threshold.
Returns:
the number of files cleaned, not including files cleaned unsuccessfully.
Throws:
DatabaseException

testProcessLN

void testProcessLN(LN targetLN,
                   long logLsn,
                   byte[] key,
                   DatabaseId dbId,
                   Map<DatabaseId,DatabaseImpl> dbCache)
Unit testing. Simulates processing of a single LN.



Copyright (c) 2004-2012 Oracle. All rights reserved.