net.walend.lyophil.soft
Class SoftFreezer

java.lang.Object
  |
  +--net.walend.lyophil.soft.SoftFreezer
All Implemented Interfaces:
Freezer

public class SoftFreezer
extends java.lang.Object
implements Freezer

This Freezer caches Freezables in a SoftMemSet as it draws them in from an authoritive Freezer. When a new Freezable is stored in this Freezer, it caches it in the SoftmemSet and stores it inside the authoritive Freezer.

Since:
20010830
Author:
David Walend

Field Summary
private  SoftMemSet cache
           
static java.lang.String MASTERFREEZER
           
 
Fields inherited from interface net.walend.lyophil.Freezer
ROLE
 
Constructor Summary
SoftFreezer()
          An empty constructor so that this Freezer can be created by a GenericDirector.
 
Method Summary
 int count()
          Returns the number of elements in this collection.
 void freeze(Freezable victem)
          Take the Thawed victem and put it in cold storage.
 SetOfFreezables getAll()
          Returns a lyophilizer.collection.Set of Freezables.
protected  Freezer getMasterFreezer()
           
 boolean isAvailable(java.io.Serializable identifier)
          Return true if identifier is available in the freezer
 boolean isEmpty()
          Returns true if this collection contains no elements.
 Freezable thaw(java.io.Serializable identifier)
          For the identifier, return a Freezable object containing the data.
 void throwOut(java.io.Serializable identifier)
          Remote the Freezable identified by identifier from the persistent storage
 void throwOutAll()
          Throw out everything in the Freezer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

private SoftMemSet cache

MASTERFREEZER

public static final java.lang.String MASTERFREEZER
Constructor Detail

SoftFreezer

public SoftFreezer()
An empty constructor so that this Freezer can be created by a GenericDirector.

Method Detail

getMasterFreezer

protected Freezer getMasterFreezer()

freeze

public void freeze(Freezable victem)
Take the Thawed victem and put it in cold storage.

Specified by:
freeze in interface Freezer
Throws:
CannotFreezeException

thaw

public Freezable thaw(java.io.Serializable identifier)
               throws NotInFreezerException
For the identifier, return a Freezable object containing the data.

Specified by:
thaw in interface Freezer
Throws:
CannotThawException
NotInFreezerException

throwOut

public void throwOut(java.io.Serializable identifier)
              throws NotInFreezerException
Remote the Freezable identified by identifier from the persistent storage

Specified by:
throwOut in interface Freezer
Throws:
CannotThrowOutException
NotInFreezerException

isAvailable

public boolean isAvailable(java.io.Serializable identifier)
Return true if identifier is available in the freezer

Specified by:
isAvailable in interface Freezer
Throws:
PersistenceFailureException

throwOutAll

public void throwOutAll()
Throw out everything in the Freezer.

Specified by:
throwOutAll in interface Freezer

getAll

public SetOfFreezables getAll()
Returns a lyophilizer.collection.Set of Freezables.

Specified by:
getAll in interface Freezer
Throws:
PersistenceFailureException

count

public int count()
Returns the number of elements in this collection. If this collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Specified by:
count in interface Freezer

isEmpty

public boolean isEmpty()
Returns true if this collection contains no elements.

Specified by:
isEmpty in interface Freezer


Copyright (c) 2000, 2001, David Walend