Class DefaultClosureMonitor
java.lang.Object
org.apache.directory.api.ldap.model.cursor.DefaultClosureMonitor
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidChecks if state of this ClosureMonitor is set to closed and if so, throws the causing Exception.final voidclose()Sets monitor state to closed, and sets the cause to a CursorClosedException without an error message string.final voidSets monitor state to closed, and sets the cause to a specific Exception.final voidSets monitor state to closed, and sets the cause to a CursorClosedException with a specific error message string.final ExceptiongetCause()Gets the cause of the closure.final booleanisClosed()Gets whether the state of this ClosureMonitor is set to closed.
-
Constructor Details
-
DefaultClosureMonitor
public DefaultClosureMonitor()
-
-
Method Details
-
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
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
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
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
Checks 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
-