cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <>
Subject Re: RejectedExecutionException when doing many invokeAsync invocations
Date Fri, 16 Apr 2010 18:42:13 GMT
On Friday 16 April 2010 9:07:55 am Leo Romanoff wrote:
> Hi,
> I'm trying to invoke 10000 external services using invokeAsync from my WS
> client.
> I set my Executor on the Service objects. This executor is a ThreadPool
> with 3 threads. But it looks like it is ignored completely by the CXF
> run-time.

Hmm...   That would be a problem.   Can you log a bug with a sample test case?   

> After roughly 250 invocations I get the RejectedExecutionException. As far
> as I understand it is related to the
> org.apache.cxf.workqueue.AutomaticWorkQueueImpl. I tried to define some
> params for it in my cxf.xml, e.g.
> 	<bean id="default-wq"
> class="org.apache.cxf.workqueue.AutomaticWorkQueueImpl">
> 		<property name="name" value="default" />
> 		<property name="highWaterMark" value="30" />
> 	</bean>
> But this does not help much. The highWaterMark sets the max number of
> threads to be used by the thread pool. And setting it to the value of 10000
> is an overkill. It really tries to start all those threads ...

highWaterMark is the number of threads.   What you need is the size of the 
queue.  Unfortunately, the underlying ThreadPoolExecutor only allows that to 
be set at constructor time, not as properties.   Thus, you would need to use 
constructor-args, not properties, to invoke the constructor:

    public AutomaticWorkQueueImpl(int mqs, 
                                  int initialThreads, 
                                  int highWaterMark, 
                                  int lowWaterMark,
                                  long dequeueTimeout,
                                  String name) {


> What I probably need to set is the max size of the queue, but I don't know
> how to do it or if it is possible at all.
> BTW, the same code works without any problems under Sun's Metro JAX-WS
> implementation.
> Am I doing something wrong?
> Thanks,
>  Leo

Daniel Kulp

View raw message