gov.sandia.ccaffeine.dc.user_iface.MVC.event
Class ThreadWaitForResultSet

java.lang.Object
  extended by java.lang.Thread
      extended by gov.sandia.ccaffeine.dc.user_iface.MVC.event.ThreadWaitForResultSet
All Implemented Interfaces:
ResultSetListener, java.lang.Runnable, java.util.EventListener

public class ThreadWaitForResultSet
extends java.lang.Thread
implements ResultSetListener

We sent a query to an entity. Wait for that entity to respond. The entity will either send us the result set or send us an exception.

We have two possible scenarios. In the first scenario, this thread is started BEFORE the entity sends back a result set in response to the query. In the second scenario, this thread is started AFTER the entity sens back a result set.

SCENARIO:
this thread is started
this thread waits for the ResultSetEvent to arrive
entity processes query and sends ResultSetEvent
This thread terminates

SCENARIO:
entity processes query and sends ResultSetEvent
this thread is started
this thread immediately terminates


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ThreadWaitForResultSet()
           
 
Method Summary
 ExceptionEvent getExceptionEvent()
          Retrieve the ExceptionEvent.
 ResultSetEvent getResultSetEvent()
          Retrieve the ResultSetEvent.
 void receivedException(ExceptionEvent event)
           
 void receivedResultSet(ResultSetEvent event)
           
 void run()
          Wait for a result set or an exception or a time out
 void start()
          Start the thread.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ThreadWaitForResultSet

public ThreadWaitForResultSet()
Method Detail

getResultSetEvent

public ResultSetEvent getResultSetEvent()
Retrieve the ResultSetEvent. The event will contain the result set of a query.

Returns:
the ResultSetEvent.

getExceptionEvent

public ExceptionEvent getExceptionEvent()
Retrieve the ExceptionEvent.

Returns:
The ExceptionEvent.

start

public void start()
Start the thread.

Overrides:
start in class java.lang.Thread

run

public void run()
Wait for a result set or an exception or a time out

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

receivedResultSet

public void receivedResultSet(ResultSetEvent event)
Specified by:
receivedResultSet in interface ResultSetListener

receivedException

public void receivedException(ExceptionEvent event)
Specified by:
receivedException in interface ResultSetListener