5 Replies Latest reply on Apr 20, 2004 2:17 PM by Claude Hussenet

    New Asynchronous Aspect .

    Claude Hussenet Newbie

      I have just completed an aspect dealing with asynchronous call.

      So the purpose of the asynchronous aspect is to drastically simplify the implementation of asynchronous call within a JVM .

      The asynchrous aspect can be used to define ONEWAY method
      BUT also REQUEST/REPLY method.

      Timeout value ,exception handling, thread pooling for ONEWAY method,access to starting time ,duration are also covered
      in the first version of the asynchronous aspect.

      See the following example.

      POJO CLASS
      ========
      public class BusinessModel {
      public BusinessModel(long sleepTime){...}
      /**
      * @@asynchronous
      */
      public void processBusinessModel() {...}
      /**
      * @@asynchronous
      */
      public long processBusinessModel2(...) {...}
      }

      BusinessModel bm1 = new BusinessModel();

      //Asynchronous call to processBusinessModel method
      long value=bm1.processBusinessModel2(100);

      AsynchronousFacade asynchronousFacade = (AsynchronousFacade)bm1;

      //Non Blocking call
      if (asynchronousFacade.isDone())
      System.out.println("It's done !");
      else
      {

      //Blocking call
      AsynchronousResponse aR = asynchronousFacade.waitForResponse();

      if (aR.getResponseCode()==OK) System.out.println("Value:"+(Long)asynchronousFacade.getReturnValue());

      else if (aR.getResponseCode()==TIMEOUT)
      .......................
      ........................
      }


      For more example please take a look in CVS
      at aspects/src/test/asynchronous/testAsynchronousAspect.java.

      Comments are welcomed.

      I will post more documentation on WIKI soon.

      Rgds,Claude