FileDocCategorySizeDatePackage
AsynchronousInvokeTask.javaAPI DocJBoss 4.2.13528Fri Jul 13 21:02:30 BST 2007org.jboss.aspects.asynchronous.aspects.jboss

AsynchronousInvokeTask

public class AsynchronousInvokeTask extends Object implements org.jboss.aspects.asynchronous.AsynchronousConstants, org.jboss.aspects.asynchronous.AsynchronousUserTask
author
{Claude Hussenet Independent Consultant}.
version
$Revision: 57186 $

Fields Summary
Constructors Summary
protected AsynchronousInvokeTask()


      super();

   
Methods Summary
public voidcleanup(org.jboss.aspects.asynchronous.AsynchronousParameters jp)


      try
      {

         InvokeTaskInputParameters ijp = (InvokeTaskInputParameters) jp;

         MethodInvocation invocation = ijp.invocation;

         Object targetedClass = invocation.getTargetObject();

         if (!invoke(targetedClass,

         invocation.getActualMethod().getParameterTypes(),

         invocation.getArguments(),

         invocation.getActualMethod().getDeclaringClass()))

            invoke(targetedClass,

            null,

            null,

            invocation.getActualMethod().getDeclaringClass());

      }
      catch (Exception e)
      {


      }

   
private booleaninvoke(java.lang.Object targetedObject, java.lang.Class[] paramemeterTypes, java.lang.Object[] parameterObjects, java.lang.Class stringName)


      try
      {

         Class aClass = null;

         if (targetedObject == null)

            aClass = stringName;

         else

            aClass = targetedObject.getClass();

         Method method = aClass.getMethod("cleanup", paramemeterTypes);

         method.invoke(targetedObject, parameterObjects);

      }
      catch (Exception e)
      {

         return false;

      }

      return true;

   
public org.jboss.aspects.asynchronous.AsynchronousResponseprocess(org.jboss.aspects.asynchronous.AsynchronousParameters jp)


      try
      {

         InvokeTaskInputParameters ijp = (InvokeTaskInputParameters) jp;

         MethodInvocation invocation = ijp.invocation;

         Object res = invocation.invokeNext();

         return new AsynchronousResponseImpl(OK, res);

      }
      catch (Throwable e)
      {

         return new AsynchronousResponseImpl(EXCEPTIONCAUGHT, e);

      }