Search in sources :

Example 11 with ClientLifeCycleManager

use of org.apache.cxf.endpoint.ClientLifeCycleManager in project tesb-rt-se by Talend.

the class EventCollector method init.

/**
 * Instantiates a new event collector.
 */
@PostConstruct
public void init() {
    // init Bus and LifeCycle listeners
    if (bus != null && sendLifecycleEvent) {
        ServerLifeCycleManager slcm = bus.getExtension(ServerLifeCycleManager.class);
        if (null != slcm) {
            ServiceListenerImpl svrListener = new ServiceListenerImpl();
            svrListener.setSendLifecycleEvent(sendLifecycleEvent);
            svrListener.setQueue(queue);
            svrListener.setMonitoringServiceClient(monitoringServiceClient);
            slcm.registerListener(svrListener);
        }
        ClientLifeCycleManager clcm = bus.getExtension(ClientLifeCycleManager.class);
        if (null != clcm) {
            ClientListenerImpl cltListener = new ClientListenerImpl();
            cltListener.setSendLifecycleEvent(sendLifecycleEvent);
            cltListener.setQueue(queue);
            cltListener.setMonitoringServiceClient(monitoringServiceClient);
            clcm.registerListener(cltListener);
        }
    }
    executor = Executors.newFixedThreadPool(this.executorPoolSize);
    scheduler = new Timer();
    scheduler.scheduleAtFixedRate(new TimerTask() {

        public void run() {
            sendEventsFromQueue();
        }
    }, 0, getDefaultInterval());
}
Also used : Timer(java.util.Timer) TimerTask(java.util.TimerTask) ServerLifeCycleManager(org.apache.cxf.endpoint.ServerLifeCycleManager) ClientListenerImpl(org.talend.esb.sam.agent.lifecycle.ClientListenerImpl) ClientLifeCycleManager(org.apache.cxf.endpoint.ClientLifeCycleManager) ServiceListenerImpl(org.talend.esb.sam.agent.lifecycle.ServiceListenerImpl) PostConstruct(javax.annotation.PostConstruct)

Aggregations

ClientLifeCycleManager (org.apache.cxf.endpoint.ClientLifeCycleManager)11 ClientLifeCycleListener (org.apache.cxf.endpoint.ClientLifeCycleListener)4 ServerLifeCycleManager (org.apache.cxf.endpoint.ServerLifeCycleManager)3 ServiceReference (org.osgi.framework.ServiceReference)3 PostConstruct (javax.annotation.PostConstruct)2 Bus (org.apache.cxf.Bus)2 Closeable (java.io.Closeable)1 IOException (java.io.IOException)1 URL (java.net.URL)1 Timer (java.util.Timer)1 TimerTask (java.util.TimerTask)1 QName (javax.xml.namespace.QName)1 Service (javax.xml.ws.Service)1 ClientLifeCycleManagerImpl (org.apache.cxf.bus.managers.ClientLifeCycleManagerImpl)1 BusLifeCycleManager (org.apache.cxf.buslifecycle.BusLifeCycleManager)1 Client (org.apache.cxf.endpoint.Client)1 Server (org.apache.cxf.endpoint.Server)1 ServerLifeCycleListener (org.apache.cxf.endpoint.ServerLifeCycleListener)1 JAXRSClientFactoryBean (org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean)1 Book (org.apache.cxf.systest.jaxrs.Book)1