I am using Weblogic 10.3, Spring 2.0,Oracle 11g. When trying to use the 'threadpoolexecutor' future task (async resp), I am getting the following exception in waiting for asynchronous response where as the bean executed by thread pool executor is 'prototype'
Note: when I am using Spring's ClassPathXmlApplicationContext to get the bean I am not getting the exception, which is not a preferred way to get beans as it loads all the beans again.
I have tried springContextAware ,ApplicationObjectSupport; those also didn't work for me.
- Error:
]", which is more than the configured time (StuckThreadMaxTime) of "600" seconds. Stack trace:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:811)
java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:969)
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1281)
java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:218)
The bean definition I have is
<bean id="PtTaskExecutor"
class="java.util.concurrent.ThreadPoolExecutor">
<constructor-arg index="0" value="1"/> <!-- corePoolSize -->
<constructor-arg index="1" value="3"/> <!-- maximumPoolSize -->
<constructor-arg index="2" type="long" value="180"/><!-- 3 minutes -->
<!-- keepAliveTime -->
<constructor-arg index="3" type="java.util.concurrent.TimeUnit">
<!-- the time unit for the keepAliveTime argument -->
<util:constant static-field="java.util.concurrent.TimeUnit.SECONDS"/>
</constructor-arg>
<constructor-arg index="4" type="java.util.concurrent.BlockingQueue">
<!-- the queue for holding tasks before they are executed -->
<bean name="LinkedBlockingQueue" class="java.util.concurrent.LinkedBlockingQueue">
<constructor-arg index="0" type="int" value="3"/> <!-- capacity -->
</bean>
</constructor-arg>
<constructor-arg index="5" type="java.util.concurrent.RejectedExecutionHandler">
<!--Execute with caller threads if queue is full -->
<bean class="java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy"/>
</constructor-arg>
</bean>
<bean id="xTask" class="***.****.*.*.*.*.XTask" scope="prototype">
<property name="XDao" ref="XDao" />
<property name="transactionTemplate" ref="transactionTemplate"/>
</bean>
-----The code part
Future<YResponseBean[]> responseArr = pTaskExecutor
.submit(xTask);
responseMap.put(i, responseArr);
then the error is from here
for (Integer i : keySet) {
// Waits for the thread response
responses[i] = responseMap.get(i).get()[0];
}
I have tried with lazy-init=true
also on threadpoolexecutor
, no luck.