org.crosswire.common.activate
Class Activator

java.lang.Object
  extended by org.crosswire.common.activate.Activator

public final class Activator
extends Object

Manager for instances of Activatable. Activator should be used to manage all activate()ions and deactivate()ions so that it can keep a track of exactly what is active and what can be deactivate()d is save memory.

Author:
Joe Walker [joe at eireneh dot com]
See Also:
for license details.
The copyright to this program is held by it's authors.

Field Summary
private static Set activated
          The list of things that we have activated
private static Lock lock
          The object we use to prevent others from
 
Constructor Summary
private Activator()
          Prevent instansiation
 
Method Summary
static void activate(Activatable subject)
          Check that a subject is activated and call activate() if not.
static void deactivate(Activatable subject)
          Deactivate an Activatable object.
static void deactivateAll()
           
static void reduceMemoryUsage(Kill amount)
          If we need to tighten things up a bit we can save memory with this
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

activated

private static Set activated
The list of things that we have activated


lock

private static Lock lock
The object we use to prevent others from

Constructor Detail

Activator

private Activator()
Prevent instansiation

Method Detail

activate

public static void activate(Activatable subject)
Check that a subject is activated and call activate() if not.

Parameters:
subject - The thing to activate

reduceMemoryUsage

public static void reduceMemoryUsage(Kill amount)
If we need to tighten things up a bit we can save memory with this


deactivate

public static void deactivate(Activatable subject)
Deactivate an Activatable object. It is safe to activate() something and then forget to deactivate() it since we keep a track of activated objects and will automatically deactivate() when needed, so this method should only be used when we are sure that something will not be needed again.

Parameters:
subject - The thing to de-activate

deactivateAll

public static void deactivateAll()

Copyright ยจ 2003-2006