com.sleepycat.je.evictor
Class SharedSelector

java.lang.Object
  extended by com.sleepycat.je.evictor.TargetSelector
      extended by com.sleepycat.je.evictor.SharedSelector

 class SharedSelector
extends TargetSelector

A shared cache is really a way of processing the caches of multiple environments. The objects that keep track of round robining between the caches, and the different shared cache selector implementation together constitute the shared cache. This selector 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.TargetSelector
TargetSelector.EvictProfile, TargetSelector.ScanInfo, TargetSelector.SetupInfo
 
Field Summary
 
Fields inherited from class com.sleepycat.je.evictor.TargetSelector
stats
 
Constructor Summary
SharedSelector(EnvironmentImpl envImpl)
           
 
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 checkEnv(EnvironmentImpl targetEnvImpl)
          Returns true if the given environment is present in the set of subject environments.
(package private)  StatGroup getINListStats(StatsConfig config)
          Return stats for the multiple INLists covered by this evictor.
(package private)  IN getNextIN()
          Returns the next IN, wrapping if necessary.
(package private)  Iterator<IN> getScanIterator()
           
 StatGroup loadStats(StatsConfig config)
           
 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(Iterator<IN> iter)
           
(package private)  TargetSelector.SetupInfo startBatch(boolean doSpecialEviction)
          Initializes the sizes if needed, and performs special eviction for one environment in rotatation.
 
Methods inherited from class com.sleepycat.je.evictor.TargetSelector
normalizeLevel, selectIN
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SharedSelector

public SharedSelector(EnvironmentImpl envImpl)
               throws DatabaseException
Throws:
DatabaseException
Method Detail

getINListStats

StatGroup getINListStats(StatsConfig config)
Return stats for the multiple INLists covered by this evictor.

Specified by:
getINListStats in class TargetSelector

loadStats

public StatGroup loadStats(StatsConfig config)
Overrides:
loadStats in class TargetSelector

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 TargetSelector

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 TargetSelector

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 TargetSelector

checkEnv

public boolean checkEnv(EnvironmentImpl targetEnvImpl)
Returns true if the given environment is present in the set of subject environments. Used in assertions.

Specified by:
checkEnv in class TargetSelector

startBatch

TargetSelector.SetupInfo startBatch(boolean doSpecialEviction)
                              throws DatabaseException
Initializes the sizes if needed, and performs special eviction for one environment in rotatation.

Specified by:
startBatch in class TargetSelector
Parameters:
doSpecialEviction - Do non-tree eviction, such as flushing the UtilizationProfile. Since special eviction is serialized, and does require I/O, some callers may not want to be blocked doing this
Throws:
DatabaseException

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 TargetSelector

getScanIterator

Iterator<IN> getScanIterator()
Specified by:
getScanIterator in class TargetSelector

setScanIterator

void setScanIterator(Iterator<IN> iter)
Specified by:
setScanIterator in class TargetSelector


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