You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by Ca...@ibs-ag.com on 2013/11/08 22:28:19 UTC

Graceful shutdown sequence

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/> | carlo.accorsi@ibs-ag.com<ma...@ibs-ag.com>

Connect With Us:
Twitter<https://twitter.com/IBSAmerica> | Facebook<https://www.facebook.com/pages/IBS-America-Inc/126278080785762> | 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


RE: Graceful shutdown sequence

Posted by Ca...@ibs-ag.com.
Hi Emmanuel, ok thanks for looking into it!

https://issues.apache.org/jira/browse/DIRSERVER-1915



-----Original Message-----
From: Emmanuel Lécharny [mailto:elecharny@gmail.com] 
Sent: Saturday, November 09, 2013 12:57 AM
To: users@directory.apache.org
Subject: Re: Graceful shutdown sequence

Hi Carlo,

it's supposed to work, so there is something whch is not handled correctly anymore.

Can you fill a JIRA with the informations you gathered ? I'm going to investigate this issue soon. Thanks !




Le 11/8/13 11:01 PM, Carlo.Accorsi@ibs-ag.com a écrit :
> 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:elecharny@gmail.com]
> Sent: Friday, November 08, 2013 4:38 PM
> To: users@directory.apache.org
> Subject: Re: Graceful shutdown sequence
>
> Hi Carlo,
>
> any idea on which thread remains up and running ?
>
>
>
> Le 11/8/13 10:28 PM, Carlo.Accorsi@ibs-ag.com 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/> | 
>> carlo.accorsi@ibs-ag.com<ma...@ibs-ag.com>
>>
>> Connect With Us:
>> Twitter<https://twitter.com/IBSAmerica> |
>> Facebook<https://www.facebook.com/pages/IBS-America-Inc/1262780807857
>> 6
>> 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
>


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


Re: Graceful shutdown sequence

Posted by Emmanuel Lécharny <el...@gmail.com>.
Hi Carlo,

it's supposed to work, so there is something whch is not handled
correctly anymore.

Can you fill a JIRA with the informations you gathered ? I'm going to
investigate this issue soon. Thanks !




Le 11/8/13 11:01 PM, Carlo.Accorsi@ibs-ag.com a écrit :
> 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:elecharny@gmail.com] 
> Sent: Friday, November 08, 2013 4:38 PM
> To: users@directory.apache.org
> Subject: Re: Graceful shutdown sequence
>
> Hi Carlo,
>
> any idea on which thread remains up and running ?
>
>
>
> Le 11/8/13 10:28 PM, Carlo.Accorsi@ibs-ag.com 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/> | 
>> carlo.accorsi@ibs-ag.com<ma...@ibs-ag.com>
>>
>> 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 
>


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


RE: Graceful shutdown sequence

Posted by Ca...@ibs-ag.com.
Not sure if this helps but 

When the shutdown request is sent. 

At org.apache.mina.filter.executor.UnorderedThreadPoolExecutor:476  
ran=true 

and this is content of task object. 

[(0x00000001: nio socket, server, null => /127.0.0.1:10389)] MESSAGE_RECEIVED: MessageType : EXTENDED_REQUEST
Message ID : 2
    Extended request
        Request name : '1.3.6.1.4.1.18060.0.1.3'
org.apache.directory.api.ldap.extras.extended.GracefulShutdownRequestImpl@2a5eb8cf

Thanks. 

-----Original Message-----
From: Carlo.Accorsi@ibs-ag.com [mailto:Carlo.Accorsi@ibs-ag.com] 
Sent: Friday, November 08, 2013 5:02 PM
To: users@directory.apache.org
Subject: RE: Graceful shutdown sequence

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:elecharny@gmail.com]
Sent: Friday, November 08, 2013 4:38 PM
To: users@directory.apache.org
Subject: Re: Graceful shutdown sequence

Hi Carlo,

any idea on which thread remains up and running ?



Le 11/8/13 10:28 PM, Carlo.Accorsi@ibs-ag.com 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/> | 
> carlo.accorsi@ibs-ag.com<ma...@ibs-ag.com>
>
> 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 


RE: Graceful shutdown sequence

Posted by Ca...@ibs-ag.com.
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:elecharny@gmail.com] 
Sent: Friday, November 08, 2013 4:38 PM
To: users@directory.apache.org
Subject: Re: Graceful shutdown sequence

Hi Carlo,

any idea on which thread remains up and running ?



Le 11/8/13 10:28 PM, Carlo.Accorsi@ibs-ag.com 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/> | 
> carlo.accorsi@ibs-ag.com<ma...@ibs-ag.com>
>
> 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 


Re: Graceful shutdown sequence

Posted by Emmanuel Lécharny <el...@gmail.com>.
Hi Carlo,

any idea on which thread remains up and running ?



Le 11/8/13 10:28 PM, Carlo.Accorsi@ibs-ag.com 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/> | carlo.accorsi@ibs-ag.com<ma...@ibs-ag.com>
>
> Connect With Us:
> Twitter<https://twitter.com/IBSAmerica> | Facebook<https://www.facebook.com/pages/IBS-America-Inc/126278080785762> | 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