Search in sources :

Example 1 with ClientListenerImpl

use of org.talend.esb.sam.agent.lifecycle.ClientListenerImpl 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

Timer (java.util.Timer)1 TimerTask (java.util.TimerTask)1 PostConstruct (javax.annotation.PostConstruct)1 ClientLifeCycleManager (org.apache.cxf.endpoint.ClientLifeCycleManager)1 ServerLifeCycleManager (org.apache.cxf.endpoint.ServerLifeCycleManager)1 ClientListenerImpl (org.talend.esb.sam.agent.lifecycle.ClientListenerImpl)1 ServiceListenerImpl (org.talend.esb.sam.agent.lifecycle.ServiceListenerImpl)1