org.ow2.clif.scenario.isac.engine
Class AsyncAlarmForwarder

java.lang.Object
  extended by java.lang.Thread
      extended by org.ow2.clif.scenario.isac.engine.AsyncAlarmForwarder
All Implemented Interfaces:
java.lang.Runnable, BladeInsertResponse

public class AsyncAlarmForwarder
extends java.lang.Thread
implements BladeInsertResponse

Wrapper for asynchronous management of alarms sent to BladeInsertResponse interface.

Author:
Bruno Dillenseger

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
 
Fields inherited from interface org.ow2.clif.server.api.BladeInsertResponse
BLADE_INSERT_RESPONSE
 
Constructor Summary
AsyncAlarmForwarder(java.lang.ThreadGroup group, BladeInsertResponse target)
          Creates a front-end for a target BladeInsertResponse object.
 
Method Summary
 void aborted()
          Direct/synchronous "aborted()" call on the target
 void alarm(AlarmEvent alarm)
          Put the provided alarm in a queue for asynchronous forwarding to the target.
 void clear()
          Discards all alarms pending in the queue.
 void completed()
          Direct/synchronous "completed()" call on the target
 void interrupt()
          Interruption override: traps interrupt for thread termination without generating InterruptedException in possibly active blocking operations (network I/O).
 void run()
          Thread activity: get alarms from the queue and forward them until the thread is interrupted.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AsyncAlarmForwarder

public AsyncAlarmForwarder(java.lang.ThreadGroup group,
                           BladeInsertResponse target)
Creates a front-end for a target BladeInsertResponse object. Alarms are asynchronously forwarded to the target, while other BladeInsertResponse calls are synchronously redirected to the target.

Parameters:
group - the thread group this thread will belong to
target - the target BladeInsertResponse object
Method Detail

clear

public void clear()
Discards all alarms pending in the queue.


alarm

public void alarm(AlarmEvent alarm)
Put the provided alarm in a queue for asynchronous forwarding to the target.

Specified by:
alarm in interface BladeInsertResponse
Parameters:
alarm - the alarm to forward to the target

aborted

public void aborted()
Direct/synchronous "aborted()" call on the target

Specified by:
aborted in interface BladeInsertResponse

completed

public void completed()
Direct/synchronous "completed()" call on the target

Specified by:
completed in interface BladeInsertResponse

run

public void run()
Thread activity: get alarms from the queue and forward them until the thread is interrupted.

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

interrupt

public void interrupt()
Interruption override: traps interrupt for thread termination without generating InterruptedException in possibly active blocking operations (network I/O). Uses notifyAll() to exit from pending wait() calls.

Overrides:
interrupt in class java.lang.Thread