title: commonj workmanager in jboss threads not waiting to complete
body: <p>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</p>
  
  <pre><code>&lt;bean id="taskExecutor" 
  class="org.springframework.scheduling.commonj.WorkManagerTaskExecutor"&gt;
  &lt;property name="workManagerName" value="java:jboss/wm/default-work-manager" /&gt;
  &lt;property name="resourceRef" value="false"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>In the Invoker class,submitting the work</p>
  
  <pre><code>@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);
  </code></pre>
  
  <p>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</p>
  
  <p>What is puzzling is the same set up works in local server with jboss 6.2 server and jdk 1.7.</p>
  
  <p>Can you please advise what could be wrong?</p>
  
  <p>I added WorkListener also</p>
  
  <pre><code>taskExecutor.schedule(work,rtWorkListener);
  </code></pre>
  
  <p>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?</p>