com.sleepycat.je.evictor
Class Evictor

java.lang.Object
  extended bycom.sleepycat.je.utilint.DaemonThread
      extended bycom.sleepycat.je.evictor.Evictor
All Implemented Interfaces:
Runnable

public class Evictor
extends DaemonThread

The Evictor looks through the INList for IN's and BIN's that are worthy of eviction. Once the nodes are selected, it removes all references to them so that they can be GC'd by the JVM.


Nested Class Summary
static class Evictor.EvictProfile
           
 
Field Summary
 
Fields inherited from class com.sleepycat.je.utilint.DaemonThread
name, nWakeupRequests, workQueue, workQueueLatch
 
Constructor Summary
Evictor(EnvironmentImpl envImpl, String name, int nodeScanPercentage, int evictionBatchPercentage)
           
 
Method Summary
 void addToQueue(Object o)
          Evictor doesn't have a work queue so just throw an exception if it's ever called.
 void alert()
          Wakeup the evictor only if it's not already active.
 void clearEnv()
           
 void doEvict()
          May be called by the evictor thread on wakeup or programatically.
(package private)  boolean isRunnable()
          Return true if eviction should happen.
 void loadStats(StatsConfig config, EnvironmentStats stat)
          Load stats.
protected  int nDeadlockRetries()
          Return the number of retries when a deadlock exception occurs.
 void onWakeup()
          Called whenever the daemon thread wakes up from a sleep.
 SortedSet selectINSet(INList inList)
          Select a set of nodes to evict.
 String toString()
           
 
Methods inherited from class com.sleepycat.je.utilint.DaemonThread
addToQueueAlreadyLatched, getNWakeupRequests, getQueueSize, getThread, 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

Evictor

public Evictor(EnvironmentImpl envImpl,
               String name,
               int nodeScanPercentage,
               int evictionBatchPercentage)
        throws DatabaseException
Method Detail

toString

public String toString()
Overrides:
toString in class DaemonThread

addToQueue

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

Overrides:
addToQueue in class DaemonThread
Throws:
DatabaseException

loadStats

public void loadStats(StatsConfig config,
                      EnvironmentStats stat)
               throws DatabaseException
Load stats.

Throws:
DatabaseException

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

alert

public void alert()
Wakeup the evictor only if it's not already active.


onWakeup

public void onWakeup()
              throws DatabaseException
Called whenever the daemon thread wakes up from a sleep.

Specified by:
onWakeup in class DaemonThread
Throws:
DatabaseException

doEvict

public void doEvict()
             throws DatabaseException
May be called by the evictor thread on wakeup or programatically.

Throws:
DatabaseException

isRunnable

boolean isRunnable()
             throws DatabaseException
Return true if eviction should happen.

Throws:
DatabaseException

selectINSet

public SortedSet selectINSet(INList inList)
                      throws DatabaseException
Select a set of nodes to evict. This is public because a unit test needs access to it. FindBugs will whine about nNodesScannedThisRun not being synchronized but it's ok. When this is called from outside, it's only in a test.

Throws:
DatabaseException


Copyright 2004 Sleepycat, Inc. All Rights Reserved.