Search in sources :

Example 1 with XMPPPacketListener

use of org.apache.axis2.transport.xmpp.util.XMPPPacketListener in project wso2-axis2-transports by wso2.

the class XMPPListener method start.

/**
 * Start a pool of Workers. For each connection in connectionFactories,
 * assign a packer listener. This packet listener will trigger when a
 * message arrives.
 */
public void start() throws AxisFault {
    // create thread pool of workers
    ExecutorService workerPool = new ThreadPoolExecutor(1, WORKERS_MAX_THREADS, WORKER_KEEP_ALIVE, TIME_UNIT, new LinkedBlockingQueue(), new org.apache.axis2.util.threadpool.DefaultThreadFactory(new ThreadGroup("XMPP Worker thread group"), "XMPPWorker"));
    Iterator iter = connectionFactories.values().iterator();
    while (iter.hasNext()) {
        XMPPConnectionFactory connectionFactory = (XMPPConnectionFactory) iter.next();
        XMPPPacketListener xmppPacketListener = new XMPPPacketListener(connectionFactory, this.configurationContext, workerPool);
        connectionFactory.listen(xmppPacketListener);
    }
}
Also used : XMPPConnectionFactory(org.apache.axis2.transport.xmpp.util.XMPPConnectionFactory) XMPPPacketListener(org.apache.axis2.transport.xmpp.util.XMPPPacketListener) ExecutorService(java.util.concurrent.ExecutorService) Iterator(java.util.Iterator) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue)

Aggregations

Iterator (java.util.Iterator)1 ExecutorService (java.util.concurrent.ExecutorService)1 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 XMPPConnectionFactory (org.apache.axis2.transport.xmpp.util.XMPPConnectionFactory)1 XMPPPacketListener (org.apache.axis2.transport.xmpp.util.XMPPPacketListener)1