com.sleepycat.je.incomp
Class INCompressor

java.lang.Object
  extended bycom.sleepycat.je.utilint.DaemonThread
      extended bycom.sleepycat.je.incomp.INCompressor
All Implemented Interfaces:
Runnable

public class INCompressor
extends DaemonThread

The IN Compressor thread.


Field Summary
 
Fields inherited from class com.sleepycat.je.utilint.DaemonThread
name, nWakeupRequests, workQueue, workQueueLatch
 
Constructor Summary
INCompressor(EnvironmentImpl env, long waitTime, String name)
           
 
Method Summary
 void addBinKeyToQueue(BIN bin, Key deletedKey)
          Adds the BIN and deleted Key to the queue if the BIN is not already in the queue, or adds the deleted key to an existing entry if one exists.
 void addBinRefToQueue(BINReference binRef)
          Adds the BINReference to the queue if the BIN is not already in the queue, or adds the deleted keys to an existing entry if one exists.
 void addMultipleBinRefsToQueue(Collection binRefs)
          Adds an entire collection of BINReferences to the queue at once.
 void addToQueue(Object o)
          The default work queue is not used because we need a map not a set.
 void clearEnv()
           
 void doCompress()
          The real work to doing a compress.
 int getBinRefQueueSize()
           
 void loadStats(StatsConfig config, EnvironmentStats stat)
          Return stats
protected  int nDeadlockRetries()
          Return the number of retries when a deadlock exception occurs.
 void onWakeup()
          onWakeup is synchronized to ensure that multiple invocations of the DaemonThread aren't made.
 BIN searchForBIN(DatabaseImpl db, BINReference binRef)
          Search the tree for the BIN or DBIN that corresponds to this BINReference.
 String toString()
           
 void verifyCursors()
           
 
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

INCompressor

public INCompressor(EnvironmentImpl env,
                    long waitTime,
                    String name)
             throws DatabaseException
Method Detail

toString

public String toString()
Overrides:
toString in class DaemonThread

clearEnv

public void clearEnv()

verifyCursors

public void verifyCursors()
                   throws DatabaseException
Throws:
DatabaseException

addToQueue

public void addToQueue(Object o)
                throws DatabaseException
The default work queue is not used because we need a map not a set.

Overrides:
addToQueue in class DaemonThread
Throws:
DatabaseException

getBinRefQueueSize

public int getBinRefQueueSize()
                       throws DatabaseException
Throws:
DatabaseException

addBinKeyToQueue

public void addBinKeyToQueue(BIN bin,
                             Key deletedKey)
                      throws DatabaseException
Adds the BIN and deleted Key to the queue if the BIN is not already in the queue, or adds the deleted key to an existing entry if one exists.

Throws:
DatabaseException

addBinRefToQueue

public void addBinRefToQueue(BINReference binRef)
                      throws DatabaseException
Adds the BINReference to the queue if the BIN is not already in the queue, or adds the deleted keys to an existing entry if one exists.

Throws:
DatabaseException

addMultipleBinRefsToQueue

public void addMultipleBinRefsToQueue(Collection binRefs)
                               throws DatabaseException
Adds an entire collection of BINReferences to the queue at once. Use this to avoid latching for each add.

Throws:
DatabaseException

loadStats

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

Throws:
DatabaseException

nDeadlockRetries

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

Overrides:
nDeadlockRetries in class DaemonThread
Throws:
DatabaseException

onWakeup

public void onWakeup()
              throws DatabaseException
Description copied from class: DaemonThread
onWakeup is synchronized to ensure that multiple invocations of the DaemonThread aren't made. isRunnable must be called from within onWakeup to avoid having the following sequence: Thread A: isRunnable() => true, Thread B: isRunnable() => true, Thread A: onWakeup() starts Thread B: waits for monitor on thread to call onWakeup() Thread A: onWakeup() completes rendering isRunnable() predicate false Thread B: onWakeup() starts, but isRunnable predicate is now false

Specified by:
onWakeup in class DaemonThread
Throws:
DatabaseException

doCompress

public void doCompress()
                throws DatabaseException
The real work to doing a compress. This may be called by the compressor thread or programatically.

Throws:
DatabaseException

searchForBIN

public BIN searchForBIN(DatabaseImpl db,
                        BINReference binRef)
                 throws DatabaseException
Search the tree for the BIN or DBIN that corresponds to this BINReference.

Parameters:
binRef - the BINReference that indicates the bin we want.
Returns:
the BIN or DBIN that corresponds to this BINReference. The node is latched upon return. Returns null if the BIN can't be found.
Throws:
DatabaseException


Copyright 2004 Sleepycat, Inc. All Rights Reserved.