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

AsynchronousFacadeImpl

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

Fields Summary
private AsynchronousFacadeFields
asynchronousFacadeFields
Constructors Summary
public AsynchronousFacadeImpl()


    
   

      asynchronousFacadeFields =

      new AsynchronousFacadeFieldsThreadLocalImpl();

   
Methods Summary
private AsynchronousFacadeFieldsgetAsynchronousFacadeFields()


      return asynchronousFacadeFields;

   
public org.jboss.aspects.asynchronous.AsynchronousTaskgetAsynchronousTask()


      return getAsynchronousFacadeFields().getAsynchronousTask();

   
public java.lang.StringgetId()


      return getAsynchronousFacadeFields().getId();

   
public intgetResponseCode()


      return getResponseCode(getAsynchronousTask());

   
public intgetResponseCode(org.jboss.aspects.asynchronous.AsynchronousTask synchronousTask)


      return (waitForResponse(synchronousTask).getResponseCode());

   
public java.lang.ObjectgetReturnValue()


      return getReturnValue(getAsynchronousTask());

   
public java.lang.ObjectgetReturnValue(org.jboss.aspects.asynchronous.AsynchronousTask asynchronousTask)


      if (asynchronousTask == null)

         return null;

      AsynchronousResponse asynchronousResponse =

      waitForResponse(asynchronousTask);

      if (asynchronousResponse.getResponseCode() == OK)

         return asynchronousResponse.getResult();

      else

         return null;

   
public org.jboss.aspects.asynchronous.ThreadManagerResponsegetThreadManagerResponse()


      return getAsynchronousTask().getResponse();

   
public longgetTimeout()


      return getAsynchronousFacadeFields().getTimeout();

   
public booleanisDone()


      return isDone(getAsynchronousTask());

   
public booleanisDone(org.jboss.aspects.asynchronous.AsynchronousTask synchronousTask)


      if (synchronousTask == null)

         return false;

      else

         return synchronousTask.isDone();

   
public voidsetAsynchronousTask(org.jboss.aspects.asynchronous.AsynchronousTask asynchronousTask)


      getAsynchronousFacadeFields().setAsynchronousTask(asynchronousTask);

   
public voidsetId(java.lang.String id)


      getAsynchronousFacadeFields().setId(id);

   
public voidsetTimeout(long timeout)


      getAsynchronousFacadeFields().setTimeout(timeout);

   
public org.jboss.aspects.asynchronous.AsynchronousResponsewaitForResponse()


      return waitForResponse(getAsynchronousTask());

   
public org.jboss.aspects.asynchronous.AsynchronousResponsewaitForResponse(org.jboss.aspects.asynchronous.AsynchronousTask asynchronousTask)


      if (asynchronousTask.getResponse().getResponseCode()

      == AsynchronousConstants.OK)
      {

         AsynchronousResponse atask =

         (AsynchronousResponse) asynchronousTask

         .getResponse()

         .getResult();

         return atask;

      }

      return asynchronousTask.getResponse();