You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Vadim Beilin (JIRA)" <ji...@apache.org> on 2014/11/07 11:18:33 UTC

[jira] [Created] (CXF-6091) Server is not properly stopped with MultipleEndpointObserver

Vadim Beilin created CXF-6091:
---------------------------------

             Summary: Server is not properly stopped with MultipleEndpointObserver
                 Key: CXF-6091
                 URL: https://issues.apache.org/jira/browse/CXF-6091
             Project: CXF
          Issue Type: Bug
          Components: Core
    Affects Versions: 3.0.1, 2.5
            Reporter: Vadim Beilin


org.apache.cxf.endpoint.ServerImpl#stop() contains this code to handle MultipleEndpointObserver:
{code}
        ...

        if (slcMgr != null) {
            slcMgr.stopServer(this);
        }

        MessageObserver mo = getDestination().getMessageObserver();
        if (mo instanceof MultipleEndpointObserver) {
            ((MultipleEndpointObserver)mo).getEndpoints().remove(endpoint);
            if (!((MultipleEndpointObserver)mo).getEndpoints().isEmpty()) {
                return;
            }
        }

        getDestination().setMessageObserver(null);
        stopped = true;
    }
{code}
The intention seems to be to not remove the message observer until there are endpoints attached, but a side effect is that in such a case the server instance is _not_ marked as stopped, and therefore cannot be restarted.

One way to solve it would be to change the code above to
{code}
        if (slcMgr != null) {
            slcMgr.stopServer(this);
        }

        MessageObserver mo = getDestination().getMessageObserver();
        if (mo instanceof MultipleEndpointObserver) {
            ((MultipleEndpointObserver)mo).getEndpoints().remove(endpoint);
            if (((MultipleEndpointObserver)mo).getEndpoints().isEmpty()) {
                getDestination().setMessageObserver(null);
            }
        } else {
            getDestination().setMessageObserver(null);
        }
        stopped = true;
    }
{code}
making sure that stopped is set on all (non-throwing) codepaths.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)