Search in sources :

Example 11 with WorkQueueManager

use of org.apache.cxf.workqueue.WorkQueueManager in project jbossws-cxf by jbossws.

the class BusHolder method setAdditionalWorkQueues.

/**
 * Adds work queues parsing simple values of properties in jboss-webservices.xml:
 *   cxf.queue.<queue-name>.<parameter> = value
 * e.g.
 *   cxf.queue.default.maxQueueSize = 500
 *
 * See constants in {@link org.jboss.wsf.stack.cxf.client.Constants}.
 *
 * @param bus
 * @param wsmd
 */
protected static void setAdditionalWorkQueues(Bus bus, Map<String, String> props) {
    if (props != null && !props.isEmpty()) {
        Map<String, Map<String, String>> queuesMap = new HashMap<String, Map<String, String>>();
        for (Entry<String, String> e : props.entrySet()) {
            String k = e.getKey();
            if (k.startsWith(Constants.CXF_QUEUE_PREFIX)) {
                String sk = k.substring(Constants.CXF_QUEUE_PREFIX.length());
                int i = sk.indexOf(".");
                if (i > 0) {
                    String queueName = sk.substring(0, i);
                    String queueProp = sk.substring(i + 1);
                    Map<String, String> m = queuesMap.get(queueName);
                    if (m == null) {
                        m = new HashMap<String, String>();
                        queuesMap.put(queueName, m);
                    }
                    m.put(queueProp, e.getValue());
                }
            }
        }
        WorkQueueManager mgr = bus.getExtension(WorkQueueManager.class);
        for (Entry<String, Map<String, String>> e : queuesMap.entrySet()) {
            final String queueName = e.getKey();
            AutomaticWorkQueue q = createWorkQueue(queueName, e.getValue());
            mgr.addNamedWorkQueue(queueName, q);
        }
    }
}
Also used : HashMap(java.util.HashMap) AutomaticWorkQueue(org.apache.cxf.workqueue.AutomaticWorkQueue) Map(java.util.Map) HashMap(java.util.HashMap) WorkQueueManager(org.apache.cxf.workqueue.WorkQueueManager) DDEndpoint(org.jboss.wsf.stack.cxf.metadata.services.DDEndpoint)

Aggregations

WorkQueueManager (org.apache.cxf.workqueue.WorkQueueManager)11 Executor (java.util.concurrent.Executor)4 IOException (java.io.IOException)3 Bus (org.apache.cxf.Bus)3 AutomaticWorkQueue (org.apache.cxf.workqueue.AutomaticWorkQueue)3 InetSocketAddress (java.net.InetSocketAddress)2 MulticastSocket (java.net.MulticastSocket)2 URI (java.net.URI)2 Endpoint (org.apache.cxf.endpoint.Endpoint)2 OneShotAsyncExecutor (org.apache.cxf.workqueue.OneShotAsyncExecutor)2 SynchronousExecutor (org.apache.cxf.workqueue.SynchronousExecutor)2 WorkQueue (org.apache.cxf.workqueue.WorkQueue)2 DatagramSocket (java.net.DatagramSocket)1 SocketException (java.net.SocketException)1 SocketTimeoutException (java.net.SocketTimeoutException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1 MBeanServer (javax.management.MBeanServer)1