com.sleepycat.je.cleaner
Class BaseLocalUtilizationTracker

java.lang.Object
  extended by com.sleepycat.je.cleaner.BaseUtilizationTracker
      extended by com.sleepycat.je.cleaner.BaseLocalUtilizationTracker
Direct Known Subclasses:
LocalUtilizationTracker, RecoveryUtilizationTracker

abstract class BaseLocalUtilizationTracker
extends BaseUtilizationTracker

Shared implementation for all local utilization trackers. Per-database utilization info is tracked in a local map rather than in the live DatabaseImpl objects. The transferToUtilizationTracker method is called to transfer per-file and per-database info to the (global) UtilizationTracker.


Field Summary
 
Fields inherited from class com.sleepycat.je.cleaner.BaseUtilizationTracker
bytesSinceActivate, cleaner, env
 
Constructor Summary
BaseLocalUtilizationTracker(EnvironmentImpl env, Map<Object,DbFileSummaryMap> dbMap)
          Creates a local tracker with a map keyed by DatabaseId or DatabaseImpl.
 
Method Summary
(package private) abstract  DatabaseImpl databaseKeyToDatabaseImpl(Object databaseKey)
          Returns the DatabaseImpl from the database key, which is either the DatabaseId or DatabaseImpl.
(package private)  Map<Object,DbFileSummaryMap> getDatabaseMap()
          Returns the map of databases; for use by subclasses.
(package private)  DbFileSummary getDbFileSummary(Object databaseKey, long fileNum)
          Allocates DbFileSummary information locally in this object rather than in the DatabaseImpl.
(package private) abstract  void releaseDatabaseImpl(DatabaseImpl db)
          Must be called after calling databaseKeyToDatabaseImpl.
(package private)  void removeDbFileSummaries(Object databaseKey)
          Deallocates all DbFileSummary objects for the given database key.
 void transferToUtilizationTracker(UtilizationTracker tracker)
          Transfers counts and offsets from this local tracker to the given (global) UtilizationTracker and to the live DatabaseImpl objects.
 
Methods inherited from class com.sleepycat.je.cleaner.BaseUtilizationTracker
close, countNew, countObsolete, countObsoleteDb, getEnvironment, getFileSummary, getTrackedFile, getTrackedFiles, isFileUncounted, isLNType, isNodeType, resetFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseLocalUtilizationTracker

BaseLocalUtilizationTracker(EnvironmentImpl env,
                            Map<Object,DbFileSummaryMap> dbMap)
Creates a local tracker with a map keyed by DatabaseId or DatabaseImpl. When used by this class dbMap is an IdentityHashMap keyed by DatabaseImpl. When used by RecoveryUtilizationTracker dbMap is a HashMap keyed by DatabaseId.

Method Detail

getDatabaseMap

Map<Object,DbFileSummaryMap> getDatabaseMap()
Returns the map of databases; for use by subclasses.


transferToUtilizationTracker

public void transferToUtilizationTracker(UtilizationTracker tracker)
                                  throws DatabaseException
Transfers counts and offsets from this local tracker to the given (global) UtilizationTracker and to the live DatabaseImpl objects.

When called after recovery has finished, must be called under the log write latch.

Throws:
DatabaseException

databaseKeyToDatabaseImpl

abstract DatabaseImpl databaseKeyToDatabaseImpl(Object databaseKey)
                                         throws DatabaseException
Returns the DatabaseImpl from the database key, which is either the DatabaseId or DatabaseImpl. The releaseDatabaseImpl must be called with the DatabaseImpl returned by this method.

Throws:
DatabaseException

releaseDatabaseImpl

abstract void releaseDatabaseImpl(DatabaseImpl db)
Must be called after calling databaseKeyToDatabaseImpl. The db parameter may be null, in which case no action is taken. If DbTree.getDb is called by the implementation of databaseKeyToDatabaseImpl, then DbTree.releaseDb must be called by the implementation of this method.


getDbFileSummary

DbFileSummary getDbFileSummary(Object databaseKey,
                               long fileNum)
Allocates DbFileSummary information locally in this object rather than in the DatabaseImpl.

Specified by:
getDbFileSummary in class BaseUtilizationTracker
Parameters:
databaseKey - is either a DatabaseId or DatabaseImpl depending on whether called from the RecoveryUtilizationTracker or LocalUtilizationTracker, respectively.
Returns:
the summary, or null if the databaseKey param is null.

removeDbFileSummaries

void removeDbFileSummaries(Object databaseKey)
Deallocates all DbFileSummary objects for the given database key. For use by subclasses.



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