org.xins.common.threads
Class Doorman

java.lang.Object
  extended byorg.xins.common.threads.Doorman

Deprecated. Deprecated since XINS 1.0.1. Use synchronized sections instead. The implementation of this class is flawed.

public final class Doorman
extends Object

Monitor that acts like a doorman. It implements a variation of the Alternating Reader Writer algorithm.

Since:
XINS 1.0.0
Version:
$Revision: 1.38 $ $Date: 2006/08/28 09:12:36 $
Author:
Ernst de Haan

Nested Class Summary
static class Doorman.QueueEntryType
          Deprecated. Type of an entry in a queue for a doorman.
 
Constructor Summary
Doorman(String name, boolean strict, int queueSize, long maxQueueWaitTime)
          Deprecated. Constructs a new Doorman with the specified initial queue size.
 
Method Summary
 void enterAsReader()
          Deprecated. Enters the 'protected area' as a reader.
 void enterAsWriter()
          Deprecated. Enters the 'protected area' as a writer.
 long getMaxQueueWaitTime()
          Deprecated. Gets the maximum time to wait in the queue.
 String getName()
          Deprecated. Gets the name of this doorman.
 void leaveAsReader()
          Deprecated. Leaves the 'protected area' as a reader.
 void leaveAsWriter()
          Deprecated. Leaves the 'protected area' as a writer.
 String toString()
          Deprecated. Returns a textual representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Doorman

public Doorman(String name,
               boolean strict,
               int queueSize,
               long maxQueueWaitTime)
        throws IllegalArgumentException
Deprecated. 
Constructs a new Doorman with the specified initial queue size.

Parameters:
name - the name for the protected area this doorman guards, to be used during logging and when creating exceptions, cannot be null.
strict - flag that indicates if strict thread synchronization checking should be performed.
queueSize - the initial queue size, must be >= 0.
maxQueueWaitTime - the maximum number of milliseconds an entry should be allowed to wait in the queue, must be >= 0.
Throws:
IllegalArgumentException - if name == null || queueSize < 0 || maxQueueWaitTime < 0L.
Method Detail

getName

public String getName()
Deprecated. 
Gets the name of this doorman.

Returns:
the name, never null

getMaxQueueWaitTime

public long getMaxQueueWaitTime()
Deprecated. 
Gets the maximum time to wait in the queue.

Returns:
the maximum wait time, always > 0.

enterAsReader

public void enterAsReader()
                   throws QueueTimeOutException
Deprecated. 
Enters the 'protected area' as a reader. If necessary, this method will wait until the area can be entered.

Throws:
QueueTimeOutException - if this thread was waiting in the queue for too long.

enterAsWriter

public void enterAsWriter()
                   throws QueueTimeOutException
Deprecated. 
Enters the 'protected area' as a writer. If necessary, this method will wait until the area can be entered.

Throws:
QueueTimeOutException - if this thread was waiting in the queue for too long.

leaveAsReader

public void leaveAsReader()
Deprecated. 
Leaves the 'protected area' as a reader.


leaveAsWriter

public void leaveAsWriter()
Deprecated. 
Leaves the 'protected area' as a writer.


toString

public String toString()
Deprecated. 
Returns a textual representation of this object.

Returns:
a textual representation of this object, never null.


See http://www.xins.org/.