Hi Emmanuel,  When the server is running, these are the threads. 

org.apache.directory.server.UberjarMain at localhost:62236      
        Daemon Thread [apacheds] (Running)      
        Daemon Thread [changePwdReplayCache.data] (Running)     
        Daemon Thread [kdcReplayCache.data] (Running)   
        Daemon Thread [ou=system.data] (Running)        
        Daemon Thread [groupCache.data] (Running)       
        Daemon Thread [Thread-1] (Running)      
        Daemon Thread [Thread-2] (Running)      
        Thread [NioSocketAcceptor-2] (Running)  
        Thread [NioSocketAcceptor-1] (Running)  
        Thread [DestroyJavaVM] (Running)        


Then I call the shutdown code from my previous message and they are all still 
running along with DestroyJavaVM.
If I suspend DestroyJavaVM, there's nothing it its call stack.

org.apache.directory.server.UberjarMain at localhost:62236      
        Daemon Thread [apacheds] (Running)      
        Daemon Thread [changePwdReplayCache.data] (Running)     
        Daemon Thread [kdcReplayCache.data] (Running)   
        Daemon Thread [ou=system.data] (Running)        
        Daemon Thread [groupCache.data] (Running)       
        Daemon Thread [Thread-1] (Running)      
        Daemon Thread [Thread-2] (Running)      
        Thread [NioSocketAcceptor-2] (Running)  
        Thread [pool-3-thread-1] (Running)      
        Thread [DestroyJavaVM] (Running)        
        Thread [pool-2-thread-1] (Running)      
        Thread [pool-7-thread-1] (Running)      


However, if I try to call the shutdown code again, the exception below is 
thrown.  Thanks..

org.apache.directory.ldap.client.api.exception.InvalidConnectionException: 
Cannot connect on the server: Connection refused: no further information
        at 
org.apache.directory.ldap.client.api.LdapNetworkConnection.connect(LdapNetworkConnection.java:560)
        at 
org.apache.directory.ldap.client.api.LdapNetworkConnection.bindAsync(LdapNetworkConnection.java:1156)
        at 
org.apache.directory.ldap.client.api.LdapNetworkConnection.bind(LdapNetworkConnection.java:1076)
        at test.Shutdown.createConnection(Shutdown.java:93)
        at test.Shutdown.shutdown(Shutdown.java:32)
        at test.Shutdown.main(Shutdown.java:23)
Caused by: java.net.ConnectException: Connection refused: no further information
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at 
sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:599)
        at 
org.apache.mina.transport.socket.nio.NioSocketConnector.finishConnect(NioSocketConnector.java:221)
        at 
org.apache.mina.transport.socket.nio.NioSocketConnector.finishConnect(NioSocketConnector.java:46)
        at 
org.apache.mina.core.polling.AbstractPollingIoConnector.processConnections(AbstractPollingIoConnector.java:442)
        at 
org.apache.mina.core.polling.AbstractPollingIoConnector.access$700(AbstractPollingIoConnector.java:64)
        at 
org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:510)
        at 
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)




-----Original Message-----
From: Emmanuel Lécharny [mailto:[email protected]] 
Sent: Friday, November 08, 2013 4:38 PM
To: [email protected]
Subject: Re: Graceful shutdown sequence

Hi Carlo,

any idea on which thread remains up and running ?



Le 11/8/13 10:28 PM, [email protected] a écrit :
> Sometimes stopping the server brutally in eclipse causes partition corruption.
> I dug through archived messages on this topic but could not find a code 
> example.
> I'm trying to shutdown gracefully so that the entire system exits, stopping 
> all the threads.
> This code below seems to shut down the incoming connections but it doesn't 
> shut down all threads. Any hints this?  Thanks!
>
>                 LdapConnection  ldapConnection = ... //admin connection
>                 GracefulShutdownRequest req = new 
> GracefulShutdownRequestImpl();
>                 req.setDelay(0);
>                 req.setTimeOffline(0);
>
>                 ExtendedResponse res = ldapConnection.extended(req);
>                 ResultCodeEnum resultCode = 
> res.getLdapResult().getResultCode();
>                 switch (resultCode)
>                 {
>                                 case SUCCESS :
>                                                 LOG.info("Server shutting 
> down");
>                                                 break;
>                                 default :
>                                                 LOG.error ("Server shutdown 
> failed : {} ", resultCode.toString());
>                 }
>
>
>
> Carlo Accorsi
>
> IBS America
> A Siemens Business
>
> 24 Hartwell Ave | Lexington | Massachusetts | 02421
> +1-781-862-9002 x129 (Office) | +1-781-676-8129 (Direct) | 
> ++1-781-862-9003 (Fax)
> www.ibs-us.com<http://www.ibs-us.com/> | 
> [email protected]<mailto:[email protected]>
>
> Connect With Us:
> Twitter<https://twitter.com/IBSAmerica> | 
> Facebook<https://www.facebook.com/pages/IBS-America-Inc/12627808078576
> 2> | LinkedIn<http://www.linkedin.com/company/2118605?trk=tyah> | 
> Blog<http://info.ibs-us.com/> | Our 
> Events<http://www.ibs-us.com/de/company/events/index.html>
>
> The Quality Management System of: IBS America, Inc.
> has been assessed and approved by National Quality Assurance, U.S.A., 
> against the provisions of:
> ISO 9001: 2008
>
>


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 

Reply via email to