org.apache.directory.server.ldap.support.extended
Class GracefulShutdownHandler

java.lang.Object
  extended by org.apache.directory.server.ldap.support.extended.GracefulShutdownHandler
All Implemented Interfaces:
ExtendedOperationHandler

public class GracefulShutdownHandler
extends java.lang.Object
implements ExtendedOperationHandler


Field Summary
static java.util.Set EXTENSION_OIDS
           
 
Constructor Summary
GracefulShutdownHandler()
           
 
Method Summary
 java.util.Set getExtensionOids()
          The OIDs of the extensions supported by this handler.
static GracefulDisconnect getGracefulDisconnect(int timeOffline, int delay, PartitionNexus nexus)
           
 java.lang.String getOid()
          Returns the EXTENSION_OID of the extended request this handler can handle.
 void handleExtendedOperation(IoSession requestor, SessionRegistry registry, ExtendedRequest req)
          Handles the specified extended operation.
static void sendGracefulDisconnect(java.util.List sessions, GracefulDisconnect msg, IoSession requestor)
          Blocks to synchronously send the same GracefulDisconnect message to all managed sessions except for the requestor of the GracefulShutdown.
static void sendNoticeOfDisconnect(java.util.List sessions, IoSession requestor)
          Blocks to synchronously send the a NoticeOfDisconnect message with the resultCode set to unavailable(52) to all managed sessions except for the requestor of the GracefulShutdown.
static void sendShutdownResponse(IoSession requestor, int messageId)
          Sends a successful response.
 void setLdapProvider(LdapProtocolProvider provider)
          Sets the LDAP provider for this extendedOperation handler.
static void waitForDelay(int delay)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTENSION_OIDS

public static final java.util.Set EXTENSION_OIDS
Constructor Detail

GracefulShutdownHandler

public GracefulShutdownHandler()
Method Detail

getOid

public java.lang.String getOid()
Description copied from interface: ExtendedOperationHandler
Returns the EXTENSION_OID of the extended request this handler can handle.

Specified by:
getOid in interface ExtendedOperationHandler

handleExtendedOperation

public void handleExtendedOperation(IoSession requestor,
                                    SessionRegistry registry,
                                    ExtendedRequest req)
                             throws javax.naming.NamingException
Description copied from interface: ExtendedOperationHandler
Handles the specified extended operation.

Specified by:
handleExtendedOperation in interface ExtendedOperationHandler
Parameters:
requestor - the MINA session object related with current connection
req - the LDAP Extended operation request
Throws:
javax.naming.NamingException

sendShutdownResponse

public static void sendShutdownResponse(IoSession requestor,
                                        int messageId)
Sends a successful response.

Parameters:
requestor -
messageId -

sendGracefulDisconnect

public static void sendGracefulDisconnect(java.util.List sessions,
                                          GracefulDisconnect msg,
                                          IoSession requestor)
Blocks to synchronously send the same GracefulDisconnect message to all managed sessions except for the requestor of the GracefulShutdown.

Parameters:
msg - the graceful disconnec extended request to send
requestor - the session of the graceful shutdown requestor

sendNoticeOfDisconnect

public static void sendNoticeOfDisconnect(java.util.List sessions,
                                          IoSession requestor)
Blocks to synchronously send the a NoticeOfDisconnect message with the resultCode set to unavailable(52) to all managed sessions except for the requestor of the GracefulShutdown.

Parameters:
requestor - the session of the graceful shutdown requestor

getGracefulDisconnect

public static GracefulDisconnect getGracefulDisconnect(int timeOffline,
                                                       int delay,
                                                       PartitionNexus nexus)

waitForDelay

public static void waitForDelay(int delay)

getExtensionOids

public java.util.Set getExtensionOids()
Description copied from interface: ExtendedOperationHandler
The OIDs of the extensions supported by this handler. This includes the request as well as any responses associated with the request. These OIDs will be registered with the server to publish them as supportedExtensions.

Specified by:
getExtensionOids in interface ExtendedOperationHandler
Returns:
the OIDs supported by this handler.

setLdapProvider

public void setLdapProvider(LdapProtocolProvider provider)
Description copied from interface: ExtendedOperationHandler
Sets the LDAP provider for this extendedOperation handler.

Specified by:
setLdapProvider in interface ExtendedOperationHandler
Parameters:
provider - the ldap protocol provider