Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6091

Server is not properly stopped with MultipleEndpointObserver

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5, 3.0.1
    • Fix Version/s: 3.0.3, 2.7.14
    • Component/s: Core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

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

              ...
      
              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;
          }
      

      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

              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;
          }
      

      making sure that stopped is set on all (non-throwing) codepaths.

        Attachments

          Activity

            People

            • Assignee:
              dkulp Daniel Kulp
              Reporter:
              vadimb Vadim Beilin
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: