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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Checks if state of this ClosureMonitor is set to closed and if so, throws the causing Exception.
    final void
    Sets monitor state to closed, and sets the cause to a CursorClosedException without an error message string.
    final void
    Sets monitor state to closed, and sets the cause to a specific Exception.
    final void
    close(String cause)
    Sets monitor state to closed, and sets the cause to a CursorClosedException with a specific error message string.
    final Exception
    Gets the cause of the closure.
    final boolean
    Gets whether the state of this ClosureMonitor is set to closed.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      close in interface ClosureMonitor
    • 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:
      close in interface ClosureMonitor
      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:
      close in interface ClosureMonitor
      Parameters:
      cause - the exception to associate with the closure
    • getCause

      public final Exception getCause()
      Gets the cause of the closure.
      Specified by:
      getCause in interface ClosureMonitor
      Returns:
      the causing Exception
    • isClosed

      public final boolean isClosed()
      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 CursorClosedException
      Checks if state of this ClosureMonitor is set to closed and if so, throws the causing Exception.
      Specified by:
      checkNotClosed in interface ClosureMonitor
      Throws:
      CursorClosedException - the cause of the closure