All Packages Class Hierarchy This Package Previous Next Index
Class magician.PerfTools.EventManager
java.lang.Object
|
+----magician.PerfTools.EventManager
- public class EventManager
- extends Object
- implements Sleeper, PerfConstants
EventManager is a class that manages the event list. Initially, EventManager
allocates itself a circular list of free NetEvents. When an event is posted
the next free slot is allocated to the event.
The writeToOutput() routine writes
all the recorded events to the given output stream.
- See Also:
- NetEvent
-
alarm
-
-
ALL_EVENT_LISTN
-
-
EVENTCLASS
-
-
eventListeners
-
-
EventQ
-
-
size
-
-
tracelevel
-
-
used
-
-
EventManager(int)
- creates a pool of free NetEvents
-
addListenerForAllEvents(NetEventListener, boolean)
- adds listener for all events generated by EventManager.
-
addListenerForEvent(String, NetEventListener, boolean)
- adds listener for specific events generated by EventManager.
-
flushBuffers(long)
-
Classes intending to use periodic flushing of the buffers must call
this method to initiate a timer.
-
getFreeEvent()
- returns the next free event in the circular list.
-
postEvent(int, String, long, long)
- posts an event by calling the NetEvent's update method (if provided)
to record event information,
else declare the variables of the NetEvent class as public and
update them directly in this method.
-
postEvent(int, String, long, long, String)
- posts an event by calling the NetEvent's update method (if provided)
to record event information,
else declare the variables of the NetEvent class as public and
update them directly in this method.
-
removeListenerForAllEvents(NetEventListener)
- removes listener registered for all events generated by EventManager.
-
removeListenerForEvent(String, NetEventListener)
- removes listener from specific events generated by EventManager.
-
stop()
- stops the EventManager and prints out all records to the output stream.
-
traceDepthSupported(int)
- check if event at particular depth should be logged
-
wakeup()
- calls internal dump routine to write records to output stream.
-
writeToOutput()
- writes out all the NetEvent objects to all listeners
EVENTCLASS
static final String EVENTCLASS
ALL_EVENT_LISTN
static final String ALL_EVENT_LISTN
size
protected int size
used
protected int used
EventQ
protected CircularList EventQ
alarm
protected Alarm alarm
eventListeners
protected EventListenerTable eventListeners
tracelevel
protected int tracelevel
EventManager
public EventManager(int size) throws IllegalArgumentException, ClassNotFoundException
- creates a pool of free NetEvents
- Parameters:
- EventName - name of Event structure being logged
- size - requires size of event pool to be created initially
- Throws: IllegalArgumentException
- thrown if the size of the list is not a positive number
- Throws: ClassNotFoundException
- thrown if the class definition does not exist
flushBuffers
protected boolean flushBuffers(long bufferFlushInterval)
- Classes intending to use periodic flushing of the buffers must call
this method to initiate a timer.
- Parameters:
- bufferFlushInterval - the interval in milliseconds
- Returns:
- s true if buffer flushing is enabled else returns false.
getFreeEvent
protected NetEvent getFreeEvent()
- returns the next free event in the circular list. Also does house keeping.
traceDepthSupported
public boolean traceDepthSupported(int depth)
- check if event at particular depth should be logged
- Parameters:
- depth - trace level for event
- Returns:
- s true if event can be logged
postEvent
public synchronized void postEvent(int traceDepth,
String eventName,
long eventTime,
long packetID,
String otherParams)
- posts an event by calling the NetEvent's update method (if provided)
to record event information,
else declare the variables of the NetEvent class as public and
update them directly in this method.
Classes implementing this method must call getFreeEvent() to get
the NetEvent object to update.
postEvent
public synchronized void postEvent(int traceDepth,
String eventName,
long eventTime,
long packetID)
- posts an event by calling the NetEvent's update method (if provided)
to record event information,
else declare the variables of the NetEvent class as public and
update them directly in this method.
Classes implementing this method must call getFreeEvent() to get
the NetEvent object to update.
wakeup
public void wakeup()
- calls internal dump routine to write records to output stream.
addListenerForEvent
public void addListenerForEvent(String EventName,
NetEventListener listener,
boolean syncFlag)
- adds listener for specific events generated by EventManager.
Listener must conform to the NetEventListener interface.
The listener can choose to be notified synchronously or asynchronously.
Typically, synchronous notification is to be used for alarms while
asynchronous notification is to be used for normal reporting.
- Parameters:
- EventName - event to listen
- listener - name of event listener
- syncFlag - set to true if notification must be immediate
- See Also:
- NetEventListener
addListenerForAllEvents
public void addListenerForAllEvents(NetEventListener listener,
boolean syncFlag)
- adds listener for all events generated by EventManager.
Listener must conform to the NetEventListener interface.
The listener can choose to be notified synchronously or asynchronously.
Typically, synchronous notification is to be used for alarms while
asynchronous notification is to be used for normal reporting.
- Parameters:
- listener - name of event listener
- syncFlag - set to true if notification must be immediate
- See Also:
- NetEventListener
removeListenerForEvent
public boolean removeListenerForEvent(String EventName,
NetEventListener listener)
- removes listener from specific events generated by EventManager.
Listener must conform to the NetEventListener interface
- Parameters:
- EventName - name of event
- listener - name of event listener
- See Also:
- NetEventListener
removeListenerForAllEvents
public boolean removeListenerForAllEvents(NetEventListener listener)
- removes listener registered for all events generated by EventManager.
Listener must conform to the NetEventListener interface
- Parameters:
- EventName - name of event
- listener - name of event listener
- See Also:
- NetEventListener
writeToOutput
protected synchronized void writeToOutput()
- writes out all the NetEvent objects to all listeners
stop
public void stop()
- stops the EventManager and prints out all records to the output stream.
All Packages Class Hierarchy This Package Previous Next Index