org.apache.directory.server.ldap.handlers
Class SearchTimeLimitingMonitor

java.lang.Object
  extended by org.apache.directory.server.ldap.handlers.SearchTimeLimitingMonitor
All Implemented Interfaces:
ClosureMonitor

public class SearchTimeLimitingMonitor
extends java.lang.Object
implements ClosureMonitor

A ClosureMonitor implementation which takes into account a time limit.

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

Constructor Summary
SearchTimeLimitingMonitor(long timeToLive, java.util.concurrent.TimeUnit unit)
          Creates a new instance of SearchTimeLimitingMonitor.
 
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

SearchTimeLimitingMonitor

public SearchTimeLimitingMonitor(long timeToLive,
                                 java.util.concurrent.TimeUnit unit)
Creates a new instance of SearchTimeLimitingMonitor.

Parameters:
timeToLive - the time before changing state to closed.
unit - the time units for the timeToLive parameter
See Also:
TimeUnit}
Method Detail

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

close

public 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 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 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 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 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


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