0 Replies Latest reply: Feb 21, 2013 10:46 AM by 989585 RSS

    Weblogic work manager is showing synchronous behavior

    989585
      Weblogic 10.3.5 and java 1.6

      There are two Workmanager tasks configured for CreateServiceAgreement flow:
      1.     ScheduleWriteServiceAgreement flow
      2.     ScheduleAlternateTask flow

      Expected behavior: These two are getting called in doExecute() method of CreateServiceAgreement operation and each of these flows is designated to be async as a separate thread gets instantiated by the WorkManager for these workItems. The caller is supposed to get the control back once they are set in WorkManager queue.

      Actual behavior: Tested several times and looks like the flow is synchronous and the main caller (doExecute()) is waiting until it gets the response from both the tasks – main flow is starting the alternate flow and the main flow is getting resumed after the alternate flow ends.
      Response object is populated twice – alternate flow first and main flow is overriding the alternate flow’s response.

      ---------------------------------------------------------------------------------------------------------------------

      EJB module level workmanager is configured in ejb-jar and weblogic-ejb-jar files

      Whenever the build is deployed before via weblogic console there used to be a warning :

      <20-Feb-2013 1:44:11 o'clock PM EST> <Warning> <WorkManager> <BEA-002919> <Unable to find a WorkManager with name WorkManager-Online. Dispatch policy WorkManager-Online will map to the default WorkManager for the application ClientServiceAgreementService_v4_0>

      We have changed the weblogic-application.xml file to include the <work-manager> element to make it visible at the application level rather than EJB module level.

      <work-manager>
      <name>WorkManager-Online</name>
      <ignore-stuck-threads>1</ignore-stuck-threads>
      </work-manager>

      This configuration when deployed is not giving any warning on the console and the application workload monitoring tab is showing that the deployed ear is using “Workmanager-Online”.

      However, createServiceAgreement webservice call is still behaving synchronous.

      ---------------------------------------------------------------------------------------------------------------

      Then I create a global work manager via weblogic console without any request class and constraints applied just workmanager is created and the requests are getting served using workmanger-online only but in synchronous fashion. How the workItems are actually handled?

      ---------------------------------------------------------------------------------------------------------------

      CommonJ code:

      CreateServiceAgreementType newRequest = new CreateServiceAgreementType();
      PropertyUtils.copyProperties(newRequest, request);
      ic = new InitialContext();
      WorkManager workmanager = (WorkManager) ic.lookup("java:comp/env/WorkManager-Online");
      CreateServiceAgreementAlternativeTask task = new CreateServiceAgreementAlternativeTask(newRequest);
      WorkItem csaItem = workmanager.schedule(task);
      Collection<WorkItem> workCollection = new ArrayList<WorkItem>();
      workCollection.add(csaItem);
      workmanager.waitForAll(workCollection, WorkManager.INDEFINITE);
      } catch (NamingException e) {
      logger.warn("scheduleAlternateTask", e.getMessage());
      } catch (Exception ee){
      logger.warn("scheduleAlternateTask", ee.getMessage());
      }