info.sswap.api.servlet
Class AsyncRIGInvocation

java.lang.Object
  extended by info.sswap.api.servlet.AsyncRIGInvocation
All Implemented Interfaces:
java.lang.Runnable

 class AsyncRIGInvocation
extends java.lang.Object
implements java.lang.Runnable

Provides an asynchronous invocation of a service with a RIG. The run() method of this class is executed in a separate thread, and it wraps the usual, synchronous execution of a method. Later, the result of the service's execution is stored in a cache, so that the caller may retrieve it.

Author:
Blazej Bulka

Field Summary
private  RIG asyncRIG
          The original asynchronous RIG submitted in this invocation
private static org.apache.log4j.Logger LOGGER
           
private  RDG rdg
          The RIG of the service being invoked.
private  java.lang.String rrgToken
          The token that will allow the caller to retrieve the resulting RRG.
 
Constructor Summary
AsyncRIGInvocation(RIG asyncRIG, RDG rdg, java.lang.String rrgToken)
          Creates a new asynchronous invocation object that will wrap in a separate thread the regular, synchronous execution of the service.
 
Method Summary
private  RIG createRIG(RRG upstreamRRG)
          Creates a RIG from an upstream RRG.
private  RRG getUpstreamRRG(RIG asyncRIG)
          Retrieves the upstream RRG given the information in the asynchronous RIG
private  void handleError(java.lang.String description, java.lang.Throwable e)
           
private  void handleError(java.lang.Throwable e)
           
private static void logDebug(SSWAPModel model)
           
private  void removeToken(RRG rrg)
           
 void run()
          Main method of the asynchronous thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final org.apache.log4j.Logger LOGGER

asyncRIG

private RIG asyncRIG
The original asynchronous RIG submitted in this invocation


rdg

private RDG rdg
The RIG of the service being invoked.


rrgToken

private java.lang.String rrgToken
The token that will allow the caller to retrieve the resulting RRG.

Constructor Detail

AsyncRIGInvocation

public AsyncRIGInvocation(RIG asyncRIG,
                          RDG rdg,
                          java.lang.String rrgToken)
Creates a new asynchronous invocation object that will wrap in a separate thread the regular, synchronous execution of the service.

Parameters:
asyncRIG - the asynchronous RIG submitted to invoke the service
rdg - the RDG for the service being invoked
rrgToken - the token that will allow the caller to retrieve the resulting RRG
Method Detail

run

public void run()
Main method of the asynchronous thread. It retrieves the input RRG and converts it into regular (non-asynchronous) RIG, invokes the service synchronously, and publishes the resulting RRG.

Specified by:
run in interface java.lang.Runnable

handleError

private void handleError(java.lang.Throwable e)

handleError

private void handleError(java.lang.String description,
                         java.lang.Throwable e)

createRIG

private RIG createRIG(RRG upstreamRRG)
Creates a RIG from an upstream RRG.

Parameters:
upstreamRRG - the upstream RRG
Returns:
the created RIG

removeToken

private void removeToken(RRG rrg)

getUpstreamRRG

private RRG getUpstreamRRG(RIG asyncRIG)
                    throws java.lang.Exception
Retrieves the upstream RRG given the information in the asynchronous RIG

Parameters:
asyncRIG - the asynchronous RIG
Returns:
the RRG
Throws:
java.lang.Exception - if there is an issue while retrieving the RIG.

logDebug

private static void logDebug(SSWAPModel model)


Copyright (c) 2011, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.