com.sleepycat.je.evictor
Class SharedEvictor

java.lang.Object
  extended by com.sleepycat.je.utilint.DaemonThread
      extended by com.sleepycat.je.evictor.Evictor
          extended by com.sleepycat.je.evictor.SharedEvictor
All Implemented Interfaces:
DaemonRunner, java.lang.Runnable

public class SharedEvictor
extends Evictor

The Evictor that operates on the INLists for multiple environments that share a single cache. Multiple iterators, once for each INList, are used to implement getNextIN. INs are returned from from each iterator in a round-robin rotation, giving larger INLists proportionally more rotations. This "mixes up" the INs from all INlists so that the LRU algorithm is applied across all lists.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.sleepycat.je.evictor.Evictor
Evictor.EvictProfile
 
Field Summary
 
Fields inherited from class com.sleepycat.je.evictor.Evictor
evictProfile, SOURCE_CRITICAL, SOURCE_DAEMON, SOURCE_MANUAL
 
Fields inherited from class com.sleepycat.je.utilint.DaemonThread
name, nWakeupRequests, stifleExceptionChatter
 
Constructor Summary
SharedEvictor(EnvironmentImpl env, java.lang.String name)
           
 
Method Summary
 void addEnvironment(EnvironmentImpl env)
          Synchronized so that the set of environments cannot be changed in the middle of an eviction (which is also synchronized).
 boolean checkEnvs(java.util.Set<EnvironmentImpl> envs)
          Returns true if the given set of environments matches the set of subject environments.
 void clearEnv()
          Only supported by PrivateEvictor.
(package private)  java.util.logging.Logger getLogger()
          Currently returns null to disable logging in the SharedEvictor.
(package private)  int getMaxINsPerBatch()
          Returns the total of all INList sizes, as of the last time sizes were initialized.
(package private)  IN getNextIN()
          Returns the next IN, wrapping if necessary.
(package private)  java.util.Iterator<IN> getScanIterator()
           
 void loadStats(StatsConfig config, EnvironmentStats stat)
          Load stats.
 void noteINListChange(int nINs)
          After 1/INIT_SIZE_THRESHOLD of all INs have been changed, reinitialize the sizes.
 void removeEnvironment(EnvironmentImpl env)
          Synchronized so that the set of environments cannot be changed in the middle of an eviction (which is also synchronized).
(package private)  void setScanIterator(java.util.Iterator<IN> iter)
           
(package private)  long startBatch()
          Initializes the sizes if needed, and performs UtilizationTracker eviction for one environment in rotatation.
 
Methods inherited from class com.sleepycat.je.evictor.Evictor
alert, doCriticalEviction, doEvict, evictBatch, nDeadlockRetries, normalizeLevel, onWakeup, setRunnableHook
 
Methods inherited from class com.sleepycat.je.utilint.DaemonThread
checkErrorListener, 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

SharedEvictor

public SharedEvictor(EnvironmentImpl env,
                     java.lang.String name)
              throws DatabaseException
Throws:
DatabaseException
Method Detail

loadStats

public void loadStats(StatsConfig config,
                      EnvironmentStats stat)
               throws DatabaseException
Description copied from class: Evictor
Load stats.

Overrides:
loadStats in class Evictor
Throws:
DatabaseException

clearEnv

public void clearEnv()
Only supported by PrivateEvictor.

Specified by:
clearEnv in class Evictor

noteINListChange

public void noteINListChange(int nINs)
After 1/INIT_SIZE_THRESHOLD of all INs have been changed, reinitialize the sizes.

Specified by:
noteINListChange in class Evictor

addEnvironment

public void addEnvironment(EnvironmentImpl env)
Synchronized so that the set of environments cannot be changed in the middle of an eviction (which is also synchronized).

Specified by:
addEnvironment in class Evictor

removeEnvironment

public void removeEnvironment(EnvironmentImpl env)
Synchronized so that the set of environments cannot be changed in the middle of an eviction (which is also synchronized).

Specified by:
removeEnvironment in class Evictor

checkEnvs

public boolean checkEnvs(java.util.Set<EnvironmentImpl> envs)
Returns true if the given set of environments matches the set of subject environments. Used in assertions.

Specified by:
checkEnvs in class Evictor

getLogger

java.util.logging.Logger getLogger()
Currently returns null to disable logging in the SharedEvictor.

Specified by:
getLogger in class Evictor

startBatch

long startBatch()
          throws DatabaseException
Initializes the sizes if needed, and performs UtilizationTracker eviction for one environment in rotatation.

Specified by:
startBatch in class Evictor
Throws:
DatabaseException

getMaxINsPerBatch

int getMaxINsPerBatch()
Returns the total of all INList sizes, as of the last time sizes were initialized.

Specified by:
getMaxINsPerBatch in class Evictor

getNextIN

IN getNextIN()
Returns the next IN, wrapping if necessary. Returns a number of INs from each INList that is proportional to the sizes of the lists. When a round is complete (we have returned the correct ratio from all INLists and all Subject.remaining fields are less than zero), start a new round by reinitializing the Subject.remaining fields.

Specified by:
getNextIN in class Evictor

getScanIterator

java.util.Iterator<IN> getScanIterator()
Specified by:
getScanIterator in class Evictor

setScanIterator

void setScanIterator(java.util.Iterator<IN> iter)
Specified by:
setScanIterator in class Evictor


Copyright (c) 2004,2008 Oracle. All rights reserved.