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

java.lang.Object
  extended by org.apache.directory.server.ldap.handlers.extended.GracefulShutdownHandler
All Implemented Interfaces:
ExtendedOperationHandler<org.apache.directory.shared.ldap.extras.extended.GracefulShutdownRequest,org.apache.directory.shared.ldap.extras.extended.GracefulShutdownResponse>

public class GracefulShutdownHandler
extends Object
implements ExtendedOperationHandler<org.apache.directory.shared.ldap.extras.extended.GracefulShutdownRequest,org.apache.directory.shared.ldap.extras.extended.GracefulShutdownResponse>

Author:
Apache Directory Project

Field Summary
static Set<String> EXTENSION_OIDS
           
 
Constructor Summary
GracefulShutdownHandler()
           
 
Method Summary
 Set<String> getExtensionOids()
          The OIDs of the extensions supported by this handler.
static org.apache.directory.shared.ldap.extras.extended.GracefulDisconnectResponse getGracefulDisconnect(int timeOffline, int delay)
           
 String getOid()
          Returns the EXTENSION_OID of the extended request this handler can handle.
 void handleExtendedOperation(LdapSession requestor, org.apache.directory.shared.ldap.extras.extended.GracefulShutdownRequest req)
          Handles the specified extended operation.
static void sendGracefulDisconnect(List<org.apache.mina.core.session.IoSession> sessions, org.apache.directory.shared.ldap.extras.extended.GracefulDisconnectResponse msg, org.apache.mina.core.session.IoSession requestor)
          Blocks to synchronously send the same GracefulDisconnect message to all managed sessions except for the requestor of the GracefulShutdown.
static void sendNoticeOfDisconnect(List<org.apache.mina.core.session.IoSession> sessions, org.apache.mina.core.session.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(org.apache.mina.core.session.IoSession requestor, int messageId)
          Sends a successful response.
 void setLdapServer(LdapServer ldapServer)
          Sets the LDAP server 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 Set<String> EXTENSION_OIDS
Constructor Detail

GracefulShutdownHandler

public GracefulShutdownHandler()
Method Detail

getOid

public 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<org.apache.directory.shared.ldap.extras.extended.GracefulShutdownRequest,org.apache.directory.shared.ldap.extras.extended.GracefulShutdownResponse>

handleExtendedOperation

public void handleExtendedOperation(LdapSession requestor,
                                    org.apache.directory.shared.ldap.extras.extended.GracefulShutdownRequest req)
                             throws Exception
Description copied from interface: ExtendedOperationHandler
Handles the specified extended operation.

Specified by:
handleExtendedOperation in interface ExtendedOperationHandler<org.apache.directory.shared.ldap.extras.extended.GracefulShutdownRequest,org.apache.directory.shared.ldap.extras.extended.GracefulShutdownResponse>
Parameters:
requestor - the session object related with current connection
req - the LDAP Extended operation request
Throws:
Exception - if failed to handle the operation

sendShutdownResponse

public static void sendShutdownResponse(org.apache.mina.core.session.IoSession requestor,
                                        int messageId)
Sends a successful response.

Parameters:
requestor - the session of the requestor
messageId - the message id associaed with this shutdown request

sendGracefulDisconnect

public static void sendGracefulDisconnect(List<org.apache.mina.core.session.IoSession> sessions,
                                          org.apache.directory.shared.ldap.extras.extended.GracefulDisconnectResponse msg,
                                          org.apache.mina.core.session.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
sessions - the IoSessions to send disconnect message to

sendNoticeOfDisconnect

public static void sendNoticeOfDisconnect(List<org.apache.mina.core.session.IoSession> sessions,
                                          org.apache.mina.core.session.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
sessions - the sessions from mina

getGracefulDisconnect

public static org.apache.directory.shared.ldap.extras.extended.GracefulDisconnectResponse getGracefulDisconnect(int timeOffline,
                                                                                                                int delay)

waitForDelay

public static void waitForDelay(int delay)

getExtensionOids

public Set<String> 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<org.apache.directory.shared.ldap.extras.extended.GracefulShutdownRequest,org.apache.directory.shared.ldap.extras.extended.GracefulShutdownResponse>
Returns:
the OIDs supported by this handler.

setLdapServer

public void setLdapServer(LdapServer ldapServer)
Description copied from interface: ExtendedOperationHandler
Sets the LDAP server for this extendedOperation handler.

Specified by:
setLdapServer in interface ExtendedOperationHandler<org.apache.directory.shared.ldap.extras.extended.GracefulShutdownRequest,org.apache.directory.shared.ldap.extras.extended.GracefulShutdownResponse>
Parameters:
ldapServer - the ldap protocol server


Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.