net.sf.jso.garbage
Class JSOGarbageCollector

java.lang.Object
  extended bynet.sf.jso.garbage.JSOGarbageCollector
All Implemented Interfaces:
GarbageCollector, java.lang.Runnable

public class JSOGarbageCollector
extends java.lang.Object
implements GarbageCollector, java.lang.Runnable

Class for storable objects garbage collector.


Constructor Summary
JSOGarbageCollector(ConnectionPool aPool, TransactionManager aTxMgr, StorageController aController)
          Constructs the collector.
 
Method Summary
 int getCurrentCycle()
          Gets current garbage collection cycle.
 PID getCurrentPID()
          Gets current storage partition's identification.
 boolean isStarted()
          Indicates if garbage collector is started.
 void run()
          Runs garbage collection.
static void safellyStop(GarbageCollector collector)
          Stops the collector without throwing exceptions.
 void set(java.util.Properties properties)
          Sets garbage collector configuration properties.
 void start()
          Starts the collector.
 void stop()
          Stops the collector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSOGarbageCollector

public JSOGarbageCollector(ConnectionPool aPool,
                           TransactionManager aTxMgr,
                           StorageController aController)
                    throws StorageException
Constructs the collector.

Method Detail

start

public void start()
           throws StorageException
Starts the collector.

Specified by:
start in interface GarbageCollector
Throws:
StorageException

stop

public void stop()
          throws StorageException
Stops the collector.

Specified by:
stop in interface GarbageCollector
Throws:
StorageException

set

public void set(java.util.Properties properties)
         throws java.lang.IllegalStateException
Sets garbage collector configuration properties. This method can only be called if collector is not running, that is, only if isStarted() method returns false.

Specified by:
set in interface GarbageCollector
Parameters:
properties - Properties containing parameters to the collector. The following properties can be used:
  • jso.garbage.partition.size: The size of a partition. Specifies the maximum number of objects a (logical) partition can have. If not specified the default size of 200 objects is used.
  • jso.garbage.collection.interval: The interval between two consecutive garbage collections, in minutes. If not specified the default interval of 10 minutes is used.
Throws:
java.lang.IllegalStateException - If collector has already been started.

isStarted

public boolean isStarted()
Indicates if garbage collector is started.

Specified by:
isStarted in interface GarbageCollector
Returns:
true if collector is running; false otherwise.

run

public void run()
Runs garbage collection.

Specified by:
run in interface java.lang.Runnable

getCurrentPID

public PID getCurrentPID()
                  throws StorageException
Gets current storage partition's identification.

Specified by:
getCurrentPID in interface GarbageCollector
Returns:
Current storage partition's identification.
Throws:
StorageException

getCurrentCycle

public int getCurrentCycle()
Gets current garbage collection cycle.

Specified by:
getCurrentCycle in interface GarbageCollector
Returns:
Current garbage collection cycle.

safellyStop

public static void safellyStop(GarbageCollector collector)
Stops the collector without throwing exceptions.