gov.nist.antd.optical.event.monitor
Class EventHandler

java.lang.Object
  |
  +--gov.nist.antd.optical.event.monitor.EventHandler

public final class EventHandler
extends java.lang.Object

This class represents the monitor event handler of the SSF optical framework. This handler is used to monitor changes in the framework in realtime

 This class was developed at the National Institute of Standards and
 Technology by employees of the Federal Government in the course of
 their official duties. Pursuant to title 17 Section 105 of the United
 States Code this software is not subject to copyright protection and
 is in the public domain.
 NIST assumes no responsibility whatsoever for its use by other parties,
 and makes no guarantees, expressed or implied, about its quality,
 reliability, or any other characteristic.
 
We would appreciate acknowledgement if the software is used.
NIST ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION AND DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.

Author:
borchert
, rouil

Nested Class Summary
(package private) static class EventHandler.EventGun
          The internal event gun.
(package private) static class EventHandler.EventTimer
          The internal event timer.
 
Field Summary
static long MAX_ACTIVE_GUNS
          Maximum number of active threads in the gun threadgroup.
private static long nextID
          The next available event id.
private static long no
          Internal number to name the events processing thread.
private static long noReceivers
          The number of registered receivers.
private static java.util.Hashtable receiver
          The list of receivers of the event handler
private static java.lang.ThreadGroup tg
          The thread group that contains all generated threads.
 
Constructor Summary
private EventHandler()
          Private constructor to avoid instantiation
 
Method Summary
static long getNextID()
          This method creates returns the new available unique event id .
static long getNoReceivers()
          Determines the number of registered receivers.
static void register(EventReceiver eventReceiver, short type)
          Registers an receiver at the event handler.
static void send(TEventObject evt)
          The event handlers sening mechanism.
static int unregister(EventReceiver eventReceiver, short type)
          Unregisters the event receiver for the specified types of events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_ACTIVE_GUNS

public static long MAX_ACTIVE_GUNS
Maximum number of active threads in the gun threadgroup.


no

private static long no
Internal number to name the events processing thread.


noReceivers

private static long noReceivers
The number of registered receivers.


nextID

private static long nextID
The next available event id. (Start value = 1)


receiver

private static final java.util.Hashtable receiver
The list of receivers of the event handler


tg

private static final java.lang.ThreadGroup tg
The thread group that contains all generated threads.

Constructor Detail

EventHandler

private EventHandler()
Private constructor to avoid instantiation

Method Detail

getNoReceivers

public static final long getNoReceivers()
Determines the number of registered receivers.


register

public static final void register(EventReceiver eventReceiver,
                                  short type)
Registers an receiver at the event handler.

Parameters:
eventReceiver - the receiver that will be registered.
type - the type of Events the receiver will be registered for.

unregister

public static final int unregister(EventReceiver eventReceiver,
                                   short type)
Unregisters the event receiver for the specified types of events.

Parameters:
eventReceiver - the receiver that will be registered.
type - the type of Events the receiver will be unregistered from.
Returns:
the number of unregistrations made.

send

public static final void send(TEventObject evt)
The event handlers sening mechanism. The event only can contain one type.

Parameters:
evt - the event that has to be send.

getNextID

public static final long getNextID()
This method creates returns the new available unique event id .

Returns:
The new unique event ID.