Readers of this list may remember a few messages from me over the last
few months in which I reported strange closed connections on JAX-WS
operations. The service in question launches itself using the embedded
jetty inside CXF, not via a webapp in an independent jetty container.
There is a jetty parameter of nominal relevance here related to jetty
garbage collecting 'idle' connections. However, I've got it set, as
best as I can tell, to avoid this problem.
So, in trying to make some sense of this, I wonder how widespread my
configuration is. I know from a survey last year that plenty of people
deploy CXF services in Jetty, but what I don't know is what fraction
of them are using the CXF embedded launch?
On the other hand, upon re-reading the code here, I'm not convinced
that I've actually accomplished the task at hand. I create a server
engine factory and a connector and configure it. The assumption is
that because I call createJettyHTTPServerEngine on the port at which I
launch the service, that I've indeed configured the relevant Jetty.
Here's some code.
/*
* Explicitly configure Jetty. We want to avoid having jetty
time things out.
*/
JettyHTTPServerEngineFactory sef = new JettyHTTPServerEngineFactory();
JettyHTTPServerEngine eng =
sef.createJettyHTTPServerEngine(endpointPort, "http");
SelectChannelConnector con = new SelectChannelConnector();
con.setName("documentDatabaseConnector");
// try to turn off Jetty's love of timing out.
con.setMaxIdleTime(Integer.MAX_VALUE);
con.setLowResourcesMaxIdleTime(Integer.MAX_VALUE);
con.setLowResourcesConnections(Integer.MAX_VALUE);
con.setPort(endpointPort);
eng.setConnector(con);
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
Map<String, Object> props = new HashMap<String, Object>();
// setting the binding isn't enough.
props.put("mtom-enabled", Boolean.TRUE);
svrFactory.setProperties(props);
svrFactory.setDataBinding(new AegisDatabinding());
svrFactory.setBindingId(SOAPBinding.SOAP11HTTP_MTOM_BINDING);
svrFactory.setServiceClass(DocumentDatabase.class);
svrFactory.setAddress("http://0.0.0.0:" + endpointPort +
"/documentDatabase");
svrFactory.setServiceBean(documentDatabaseImpl);
LOG.info("Launching service endpoint: " + svrFactory.getAddress());
server = svrFactory.create();