You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Serhii Nesteruk (JIRA)" <ji...@apache.org> on 2011/08/03 16:36:27 UTC

[jira] [Issue Comment Edited] (CXF-3700) the stopServer() method in ServerLifeCycleListener has been invoked twice when a service stopped

    [ https://issues.apache.org/jira/browse/CXF-3700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13078772#comment-13078772 ] 

Serhii Nesteruk edited comment on CXF-3700 at 8/3/11 2:35 PM:
--------------------------------------------------------------

I make some investigation of the problem. First time stopServer() method called from BusLifeCycleListener.preshutdown() as expected. Second time stopServer() called from spring when he tries destroy endPoint bean. EndPointImpl.stop() method is called which in turn makes the call to server.destroy() method once again.
I am not sure about the correct solution, but one of the possible way is to refactor EndointImpl to use ServerRegistry to destroy servers. Another way is that you can modify ServerImpl.stop() method:
    public void stop() {
        LOG.fine("Server is stopping.");
        
        if (slcMgr != null) {
            slcMgr.stopServer(this);

            // add this line

            slcMgr = null; 
        }

      was (Author: snesteruk):
    I make some investigation of the problem. First time stopServer() method called from BusLifeCycleListener.preshutdown() as expected. Second time stopServer() called from spring when he tries destroy endPoint bean. EndPointImpl.stop() method is called which in turn makes the call to server.destroy() method once again.
I am not sure about the correct solution, but one of the possible way is to refactor EndointImpl to use ServerRegistry to destroy servers. Another way is that you can modify ServerImpl.stop() method:
    public void stop() {
        LOG.fine("Server is stopping.");
        
        if (slcMgr != null) {
            slcMgr.stopServer(this);
            // add this line
            slcMgr = null; 
        }
  
> the stopServer() method in ServerLifeCycleListener has been invoked twice when a service stopped
> ------------------------------------------------------------------------------------------------
>
>                 Key: CXF-3700
>                 URL: https://issues.apache.org/jira/browse/CXF-3700
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.4.1, 2.5
>            Reporter: Xilai Dai
>              Labels: ServerLifeCycleListener
>         Attachments: testlifecycle.zip
>
>
> when implemented a ServerLifeCycleListener and register it to Bus, the stopServer() method in ServerLifeCycleListener will be invoked twice when stopped service.
> public class ServiceListenerImpl implements ServerLifeCycleListener{
>  public void stopServer(Server server) {
>    ......
>  }
> }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira