if ( !slc.getPrincipal().getName().equalsIgnoreCase( PartitionNexus.ADMIN_PRINCIPAL ) )
if ( !slc.getPrincipal().getName().equalsIgnoreCase( PartitionNexus.ADMIN_PRINCIPAL_NORMALIZED ) )
    public void handleExtendedOperation( IoSession requestor, SessionRegistry registry, ExtendedRequest req )        throws NamingException    {        DirectoryService service = null;        ServerLdapContext slc = null;        LdapContext ctx = registry.getLdapContext( requestor, null, false );        ctx = ( LdapContext ) ctx.lookup( "" );        // setup some of the variables we need and make sure they are of the         // right types otherwise send back an operations error in response        if ( ctx instanceof ServerLdapContext )        {            slc = ( ServerLdapContext ) ctx;            service = slc.getService();        }        else        {            log.error( "Encountered session context which was not a ServerLdapContext" );            GracefulShutdownResponse msg = new GracefulShutdownResponse( req.getMessageId(),                ResultCodeEnum.OPERATIONSERROR );            msg.getLdapResult().setErrorMessage( "The session context was not a ServerLdapContext" );            requestor.write( msg );            return;        }        // make sue only the administrator can issue this shutdown request if         // not we respond to the requestor with with insufficientAccessRights(50)        if ( !slc.getPrincipal().getName().equalsIgnoreCase( PartitionNexus.ADMIN_PRINCIPAL ) )        {            if ( log.isInfoEnabled() )            {                log.info( "Rejected with insufficientAccessRights to attempt for server shutdown by "                    + slc.getPrincipal().getName() );            }            requestor                .write( new GracefulShutdownResponse( req.getMessageId(), ResultCodeEnum.INSUFFICIENTACCESSRIGHTS ) );            return;        }        // -------------------------------------------------------------------        // handle the body of this operation below here        // -------------------------------------------------------------------        IoAcceptor acceptor = ( IoAcceptor ) requestor.getService();        List sessions = new ArrayList( acceptor.getManagedSessions( requestor.getServiceAddress() ) );        StartupConfiguration cfg = service.getConfiguration().getStartupConfiguration();        GracefulShutdownRequest gsreq = ( GracefulShutdownRequest ) req;        // build the graceful disconnect message with replicationContexts        PartitionNexus nexus = service.getConfiguration().getPartitionNexus();        GracefulDisconnect notice = getGracefulDisconnect( gsreq.getTimeOffline(), gsreq.getDelay(), nexus );        // send (synch) the GracefulDisconnect to each client before unbinding        sendGracefulDisconnect( sessions, notice, requestor );        // wait for the specified delay before we unbind the service         waitForDelay( gsreq.getDelay() );        // -------------------------------------------------------------------        // unbind the server socket for the LDAP service here so no new         // connections are accepted while we process this shutdown request        // note that the following must be issued before binding the ldap        // service in order to prevent client disconnects on service unbind:        //         // minaRegistry.getAcceptor( service.getTransportType() )        //                       .setDisconnectClientsOnUnbind( false );        // -------------------------------------------------------------------        // This might not work, either.        acceptor.unbind( requestor.getServiceAddress() );        // -------------------------------------------------------------------        // synchronously send a NoD to clients that are not aware of this resp        // after sending the NoD the client is disconnected if still connected        // -------------------------------------------------------------------        sendNoticeOfDisconnect( sessions, requestor );        // -------------------------------------------------------------------        // respond back to the client that requested the graceful shutdown w/        // a success resultCode which confirms all clients have been notified        // via the graceful disconnect or NoD and the service has been unbound        // preventing new connections; after recieving this response the         // requestor should disconnect and stop using the connection        // -------------------------------------------------------------------        sendShutdownResponse( requestor, req.getMessageId() );        if ( cfg.isExitVmOnShutdown() )        {            System.exit( 0 );        }        return;    }