ewe.sys
Class SlowTaskException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjava.lang.RuntimeException
              extended byewe.sys.SlowTaskException

public class SlowTaskException
extends RuntimeException

This class can be thrown by a method if its operations, under some circumstances may take a long time. Instead of hanging the calling thread, it can throw this exception, which contains a Handle that can be used to monitor the state of the operation and retrieve the results.

However Handles cannot be used by non-mThread threads and so a static method is provided that will provide a SlowTaskException ONLY if the current thread is a mThread thread. The method that wants to throw such an exception can then call this static method and check if a SlowTaskException was returned. If one was, then it can start up a new Thread to perform the task, and use the handle to report the progress of the operation. If a SlowTaskException was not returned, then it should just go ahead and do the task as normal.


Constructor Summary
SlowTaskException(Handle h)
           
SlowTaskException(String message, Handle h)
           
SlowTaskException(String message, Throwable cause)
           
SlowTaskException(Throwable cause)
           
 
Method Summary
 Handle getHandle()
          Get the handle for the task being performed.
static SlowTaskException getNew()
          This returns a new SlowTaskException ONLY if the calling thread is an mThread thread.
static SlowTaskException getNew(String message)
          This returns a new SlowTaskException ONLY if the calling thread is an mThread thread.
static SlowTaskException getNew(String message, Handle h)
          This returns a new SlowTaskException ONLY if the calling thread is an mThread thread.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getMessage, initCause, printStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode
 

Constructor Detail

SlowTaskException

public SlowTaskException(Handle h)

SlowTaskException

public SlowTaskException(String message,
                         Handle h)

SlowTaskException

public SlowTaskException(Throwable cause)

SlowTaskException

public SlowTaskException(String message,
                         Throwable cause)
Method Detail

getHandle

public Handle getHandle()
Get the handle for the task being performed.


getNew

public static SlowTaskException getNew(String message)
This returns a new SlowTaskException ONLY if the calling thread is an mThread thread.

Parameters:
message - An optional message for the exception.
Returns:
a new SlowTaskException ONLY if the calling thread is an mThread thread.

getNew

public static SlowTaskException getNew(String message,
                                       Handle h)
This returns a new SlowTaskException ONLY if the calling thread is an mThread thread.

Parameters:
message - An optional message for the exception.
h - A Handle to be used for the task.
Returns:
a new SlowTaskException ONLY if the calling thread is an mThread thread.

getNew

public static SlowTaskException getNew()
This returns a new SlowTaskException ONLY if the calling thread is an mThread thread.

Returns:
a new SlowTaskException ONLY if the calling thread is an mThread thread.