We've had major problems with Jetty with shutting down the port and then retrying to restart it immediately. If we tried to cycle things quickly (like a shutdown of one service and than immediately a publish of another on the same port), then requests to the second service sometimes wouldn't get there. Caveat: I'm not sure if the latest Jetty versions have fixed that.

In general, we leave it open as that was the only way to make sure we can reliably get the messages. To completely shut it down, you need to shutdown the bus. BusFactory.getDefaultBus().shutdown(true); should completely shutdown everything.

To answer your other questions, when you stop a service, all that happens is that the Handler is unregistered with Jetty. Thus, requests that have already been dispatched to the handler will continue. Future requests would get a 404.

Dan



On May 22, 2008, at 9:31 AM, Kjell Winblad wrote:

Hi,

I have two question regarding the closing of services. I have made an
user interface for a webservice and it shall be possible to start and
stop the service from the interface. I use the following code to create
and publish the service:

import javax.xml.ws.Endpoint;
import org.apache.cxf.jaxws.EndpointImpl;

...

GreeterImpl serverImpl = new GreeterImpl()
Endpoint end = Endpoint.create(serverImpl);
EndpointImpl endpoint = (EndpointImpl) end;
endpoint.setWsdlLocation(wsdlfile);
end.publish("http://localhost:6002/WS";);

The server uses HTTP as transport and works great. When I check the
opened ports on my machine I can see that CXF has opened the port I
specified in my publish address. The problem occures when I try to stop
the service. I use the the method stop() on my endpont instance. No
exceptions are thrown and it isn't possible to send requests to the
service anymore. So, the stop method seems to work but the opened port
is still open. What is supposed to happen when stop() is called on an
Endpoint, shall the associated port close? If it shall stay open how do
I close a port that has been opened by the Endpoint#publish() method?

The second question is:
What happens with received but not processed requests when
Endpoint#stop() is called? Before the service is stopped I want to be
sure that response messages for all the requests that already have been
recived to the service have been sent. So, does the Endpoint#stop()
method wait until all response messages for incoming request have been
sent before it stops the service?

Thanks in advance,
Kjell Winblad



---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog




Reply via email to