We have deployed commonj workmanager rar in jboss EAP 6.4.9.GA and jdk 1.7. We are using the workmanager reference to create multiple threads in case of multiple file uploads.We have the default configuration for the workmanager with 50 value for max threads, core threads, queue length. We have defined dependency in spring xml as
<bean id="taskExecutor"
class="org.springframework.scheduling.commonj.WorkManagerTaskExecutor">
<property name="workManagerName" value="java:jboss/wm/default-work-manager" />
<property name="resourceRef" value="false"/>
</bean>
In the Invoker class,submitting the work
@Component
public class RealtimeServiceInvoker
@Autowired
private WorkManagerTaskExecutor taskExecutor;
public Response execute(..)....
for(FileBean fileBean:fileList){
SampleWork work = new SampleWork ();
work.setFileBean(fileBean);
colWorkItems.add(taskExecutor.schedule(work));
requestList.add(work);
}
taskExecutor.waitForAll(colWorkItems, WorkManager.INDEFINITE);
What i am seeing is the taskexecutor is not waiting for the tasks to be completed and during next step, we are trying to fetch result from Work object, and it is throwing exception
What is puzzling is the same set up works in local server with jboss 6.2 server and jdk 1.7.
Can you please advise what could be wrong?
I added WorkListener also
taskExecutor.schedule(work,rtWorkListener);
I am getting logs in Listener for workAccepted and WorkStarted. The workmanager deos not wait for thread to complete.If there any alternate way to implement wait for threads to complete using Listener?
I tried to re install the commonj workmanager in the jboss server and it worked.It could have been old version of workmanager in the server. But the behavior was weird.