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, 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
name, nWakeupRequests, workQueue, workQueueLatch
 
Constructor Summary
FileProcessor(String name, EnvironmentImpl env, Cleaner cleaner, UtilizationProfile profile, FileSelector fileSelector)
           
 
Method Summary
 void addToQueue(Object o)
          Cleaner doesn't have a work queue so just throw an exception if it's ever called.
 void clearEnv()
           
 int doClean(boolean invokedFromDaemon, boolean cleanMultipleFiles, boolean forceCleaning)
          Cleans selected files and returns the number of files cleaned.
protected  int nDeadlockRetries()
          Return the number of retries when a deadlock exception occurs.
 void onWakeup()
          Activates the cleaner.
 String toString()
          XXX: Was this intended to override Thread.toString()? If so it no longer does, because we separated Thread from DaemonThread.
 
Methods inherited from class com.sleepycat.je.utilint.DaemonThread
addToQueueAlreadyLatched, getNWakeupRequests, getQueueSize, getThread, isRunning, isShutdownRequested, requestShutdown, run, runOrPause, shutdown, 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,
              FileSelector fileSelector)
Method Detail

clearEnv

public void clearEnv()

nDeadlockRetries

protected int nDeadlockRetries()
                        throws DatabaseException
Return the number of retries when a deadlock exception occurs.

Overrides:
nDeadlockRetries in class DaemonThread
Throws:
DatabaseException

addToQueue

public void addToQueue(Object o)
                throws DatabaseException
Cleaner doesn't have a work queue so just throw an exception if it's ever called.

Overrides:
addToQueue in class DaemonThread
Throws:
DatabaseException

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

toString

public String toString()
XXX: Was this intended to override Thread.toString()? If so it no longer does, because we separated Thread from DaemonThread.

Overrides:
toString in class DaemonThread


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