org.apache.directory.server.core.cursor
Class DefaultClosureMonitor

java.lang.Object
  extended by org.apache.directory.server.core.cursor.DefaultClosureMonitor
All Implemented Interfaces:
ClosureMonitor

public class DefaultClosureMonitor
extends java.lang.Object
implements ClosureMonitor

A basic ClosureMonitor that simply uses a boolean for state and a cause exception. Note that we consciously chose not to synchronize close() operations with checks to see if the monitor state is closed because it costs to synchronize and it's OK for the Cursor not to stop immediately when close() is called.

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Constructor Summary
DefaultClosureMonitor()
           
 
Method Summary
 void checkNotClosed()
          Checks if state of this ClosureMonitor is set to closed and if so, throws the causing Exception.
 void close()
          Sets monitor state to closed, and sets the cause to a CursorClosedException without an error message string.
 void close(java.lang.Exception cause)
          Sets monitor state to closed, and sets the cause to a specific Exception.
 void close(java.lang.String cause)
          Sets monitor state to closed, and sets the cause to a CursorClosedException with a specific error message string.
 java.lang.Exception getCause()
          Gets the cause of the closure.
 boolean isClosed()
          Gets whether the state of this ClosureMonitor is set to closed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultClosureMonitor

public DefaultClosureMonitor()
Method Detail

close

public final void close()
Description copied from interface: ClosureMonitor
Sets monitor state to closed, and sets the cause to a CursorClosedException without an error message string.

Specified by:
close in interface ClosureMonitor

close

public final void close(java.lang.String cause)
Description copied from interface: ClosureMonitor
Sets monitor state to closed, and sets the cause to a CursorClosedException with a specific error message string.

Specified by:
close in interface ClosureMonitor
Parameters:
cause - error message string

close

public final void close(java.lang.Exception cause)
Description copied from interface: ClosureMonitor
Sets monitor state to closed, and sets the cause to a specific Exception.

Specified by:
close in interface ClosureMonitor
Parameters:
cause - the exception to associate with the closure

getCause

public final java.lang.Exception getCause()
Description copied from interface: ClosureMonitor
Gets the cause of the closure.

Specified by:
getCause in interface ClosureMonitor
Returns:
the causing Exception

isClosed

public final boolean isClosed()
Description copied from interface: ClosureMonitor
Gets whether the state of this ClosureMonitor is set to closed.

Specified by:
isClosed in interface ClosureMonitor
Returns:
true if state is closed, false if open

checkNotClosed

public void checkNotClosed()
                    throws java.lang.Exception
Description copied from interface: ClosureMonitor
Checks if state of this ClosureMonitor is set to closed and if so, throws the causing Exception.

Specified by:
checkNotClosed in interface ClosureMonitor
Throws:
java.lang.Exception - the cause of the closure


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.