org.xins.client.async
Class CallCAPIThread

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.xins.client.async.CallCAPIThread
All Implemented Interfaces:
Runnable

public class CallCAPIThread
extends Thread

Class used to call an API in a separate thread. To call the API, you will need to invoke the Thread.start() method. If you want to wait for the result at a certain point in your program, invoke the Thread.join() method.

Since:
XINS 1.4.0
Version:
$Revision: 1.8 $ $Date: 2006/08/28 09:12:34 $
Author:
Anthony Goubard

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CallCAPIThread(AbstractCAPI capi, AbstractCAPICallRequest request)
          Calls a CAPI function on a separate thread.
 
Method Summary
 AbstractCAPI getCAPI()
          Gets the CAPI used to call the function.
 long getDuration()
          Gets the time it took to call the function.
 Exception getException()
          Gets the exception thrown by the CAPI call.
 AbstractCAPICallRequest getRequest()
          Gets the request used to the call the function.
 AbstractCAPICallResult getResult()
          Gets the result returned by the function.
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CallCAPIThread

public CallCAPIThread(AbstractCAPI capi,
                      AbstractCAPICallRequest request)
Calls a CAPI function on a separate thread.

Parameters:
capi - the CAPI to use to call the function.
request - the input parameters for this call.
Method Detail

run

public void run()

getCAPI

public AbstractCAPI getCAPI()
Gets the CAPI used to call the function.

Returns:
the CAPI used to call the function.

getRequest

public AbstractCAPICallRequest getRequest()
Gets the request used to the call the function.

Returns:
the request used to the call the function.

getResult

public AbstractCAPICallResult getResult()
Gets the result returned by the function. You may want then to cast the AbstractCAPICallResult to the generated result file normally returned by the CAPI call.

Returns:
the successful result returned by the function.

getException

public Exception getException()
Gets the exception thrown by the CAPI call.

Returns:
the exception, most probably a sub class of the CallException.

getDuration

public long getDuration()
Gets the time it took to call the function.

Returns:
the duration of the call in milliseconds.


See http://www.xins.org/.