org.crosswire.common.activate
Class Activator

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

public 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.

Distribution Licence:
JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
The copyright to this program is held by it's authors.

Version:
$Id: Activator.java,v 1.3 2005/03/19 01:57:01 dmsmith Exp $
Author:
Joe Walker [joe at eireneh dot com]
See Also:
Licence

Field Summary
private static Set activated
          The list of things that we have activated
static int KILL_EVERYTHING
          Try as hard as possible to conserve memory
static int KILL_LEAST_USED
          Reduce memory usage, but only where sensible
static int KILL_ONLY_IF_TIGHT
          Reduce memory usage, but only if we really need to
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 reduceMemoryUsage(int 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

KILL_EVERYTHING

public static final int KILL_EVERYTHING
Try as hard as possible to conserve memory

See Also:
Constant Field Values

KILL_LEAST_USED

public static final int KILL_LEAST_USED
Reduce memory usage, but only where sensible

See Also:
Constant Field Values

KILL_ONLY_IF_TIGHT

public static final int KILL_ONLY_IF_TIGHT
Reduce memory usage, but only if we really need to

See Also:
Constant Field Values

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(int 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

Copyright ? 2003-2004