net.sf.sapjcosupport
Class AsyncMethodCall

java.lang.Object
  extended byjava.lang.Thread
      extended bynet.sf.sapjcosupport.AsyncMethodCall
All Implemented Interfaces:
Runnable

public abstract class AsyncMethodCall
extends Thread

Utility class to execute a method call asynchronously.

This asynchronous method invoker uses a 'pull' mechanism to await completion. The client code just calls Thread.start() and continues doing what it needs to do. When it is ready to wait for completion of the async method, it calls waitForCompletion().

Since:
1.0
Author:
Niki Driessen

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AsyncMethodCall()
           
 
Method Summary
protected abstract  void executeMethod()
          Implementation code of the method call.
 void run()
          This method is a subclassed Thread.run() method that handles executing the actual method.
 void waitForCompletion()
          Synchronization point for the asynchronous method.
 
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

AsyncMethodCall

public AsyncMethodCall()
Method Detail

executeMethod

protected abstract void executeMethod()
Implementation code of the method call.

This is the code that gets executed asynchronously, when Thread.start() is called.

See Also:
Thread.start()

run

public void run()
This method is a subclassed Thread.run() method that handles executing the actual method.

See Also:
executeMethod(), Thread.start(), Thread.stop(), Thread.Thread(ThreadGroup, Runnable, String), Runnable.run()

waitForCompletion

public void waitForCompletion()
Synchronization point for the asynchronous method.

Call this method when you are ready to wait for the async method to complete its work. This method will block until executeMethod() is finished (which can be the case when this method is called, and it will return immediately...)



Copyright © 2006 null. All Rights Reserved.