net.walend.lyophil.queuedwrite.test
Class SleepyQueuedWriteFreezer

java.lang.Object
  |
  +--net.walend.lyophil.queuedwrite.QueuedWriteFreezer
        |
        +--net.walend.lyophil.queuedwrite.test.SleepyQueuedWriteFreezer
All Implemented Interfaces:
Freezer

public class SleepyQueuedWriteFreezer
extends QueuedWriteFreezer

This subclass of QueuedWriteFreezer is specially built for testing. It sleeps a bit before calling any of the read commands, to let the writing thread catch up.

Since:
20010907
Author:
David Walend

Nested Class Summary
 
Nested classes inherited from class net.walend.lyophil.queuedwrite.QueuedWriteFreezer
 
Field Summary
 
Fields inherited from class net.walend.lyophil.queuedwrite.QueuedWriteFreezer
MASTERFREEZER
 
Fields inherited from interface net.walend.lyophil.Freezer
ROLE
 
Constructor Summary
SleepyQueuedWriteFreezer()
          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.
 SetOfFreezables getAll()
          Returns a lyophilizer.collection.Set of Freezables.
 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.
private  void sleep()
           
 Freezable thaw(java.io.Serializable identifier)
          For the identifier, return a Freezable object containing the data.
 
Methods inherited from class net.walend.lyophil.queuedwrite.QueuedWriteFreezer
freeze, getMasterFreezer, throwOut, throwOutAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SleepyQueuedWriteFreezer

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

Method Detail

sleep

private void sleep()

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
Overrides:
thaw in class QueuedWriteFreezer
Throws:
CannotThawException
NotInFreezerException

isAvailable

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

Specified by:
isAvailable in interface Freezer
Overrides:
isAvailable in class QueuedWriteFreezer
Throws:
PersistenceFailureException

getAll

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

Specified by:
getAll in interface Freezer
Overrides:
getAll in class QueuedWriteFreezer
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
Overrides:
count in class QueuedWriteFreezer

isEmpty

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

Specified by:
isEmpty in interface Freezer
Overrides:
isEmpty in class QueuedWriteFreezer


Copyright (c) 2000, 2001, David Walend