Class DefaultClosureMonitor
- java.lang.Object
-
- org.apache.directory.api.ldap.model.cursor.DefaultClosureMonitor
-
- All Implemented Interfaces:
ClosureMonitor
public class DefaultClosureMonitor extends 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.- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Constructor Description DefaultClosureMonitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckNotClosed()Checks if state of this ClosureMonitor is set to closed and if so, throws the causing Exception.voidclose()Sets monitor state to closed, and sets the cause to a CursorClosedException without an error message string.voidclose(Exception cause)Sets monitor state to closed, and sets the cause to a specific Exception.voidclose(String cause)Sets monitor state to closed, and sets the cause to a CursorClosedException with a specific error message string.ExceptiongetCause()Gets the cause of the closure.booleanisClosed()Gets whether the state of this ClosureMonitor is set to closed.
-
-
-
Method Detail
-
close
public final void close()
Sets monitor state to closed, and sets the cause to a CursorClosedException without an error message string.- Specified by:
closein interfaceClosureMonitor
-
close
public final void close(String cause)
Sets monitor state to closed, and sets the cause to a CursorClosedException with a specific error message string.- Specified by:
closein interfaceClosureMonitor- Parameters:
cause- error message string
-
close
public final void close(Exception cause)
Sets monitor state to closed, and sets the cause to a specific Exception.- Specified by:
closein interfaceClosureMonitor- Parameters:
cause- the exception to associate with the closure
-
getCause
public final Exception getCause()
Gets the cause of the closure.- Specified by:
getCausein interfaceClosureMonitor- Returns:
- the causing Exception
-
isClosed
public final boolean isClosed()
Gets whether the state of this ClosureMonitor is set to closed.- Specified by:
isClosedin interfaceClosureMonitor- Returns:
- true if state is closed, false if open
-
checkNotClosed
public void checkNotClosed() throws CursorClosedExceptionChecks if state of this ClosureMonitor is set to closed and if so, throws the causing Exception.- Specified by:
checkNotClosedin interfaceClosureMonitor- Throws:
CursorClosedException- the cause of the closure
-
-