Hi Sean,
Sounds good to me. There is no such mechanism at the moment, all we have
is the BusLifeCycleListener and BusLifeCyclemanager APIs. The latter
are not widely used yet and may be replaced by support for JSR 250
@PreDestroy, see https://issues.apache.org/jira/browse/CXF-259, which is
not suitable for on-demand servers.
Endpoint.stop would be the better point to release resources associated
with a server endpoint in RM then Bus.shutdown.
It may even be useful to have a similar thing on the client side (proxy
creation would be OK, but there is no such thing as proxy destroy in the
JAX-WS APIs, not in the underlying CXF APIs. Maybe we can think about
that to at some time, but for server side endpoint a mechanisms like the
below definitely seems useful to me.
BTW getEndpoint should be added to the Server API - currently its only a
public method in ServerImpl, requiring annoying casts.
Andrea.
O'Callaghan, Sean wrote:
Hi,
I'd like to be able to recieve notification of when an endpoints server starts
and stops, and get info on that server instance.
At the moment there does not appear to be anyway to hook into such lifecycle so
would like to propose adding in a ServerLifeCycleManager and
ServerLifeCycleListener to the api's.
Something along the lines of :
org.apache.cxf.endpoint.ServerLifeCycleManager {
startServer(org.apache.cxf.endpoint.Server server)
stopServer(org.apache.cxf.endpoint.Server server)
registerListener(ServerLifeCycleListener listener)
unRegisterListener(ServerLifeCycleListener listener)
}
org.apache.cxf.endpoint.ServerLifeCycleListener {
startServer(org.apache.cxf.endpoint.Server server)
stopServer(org.apache.cxf.endpoint.Server server)
}
where the ServerImpl would be modified to access the ServerLifeCycleManager.
Does this approach seem okay to people or is there another mechanism already
within CXF that can do this.
Thanks,
Seán.