Package gov.aps.jca.event
Class QueuedEventDispatcher
- java.lang.Object
-
- gov.aps.jca.event.AbstractEventDispatcher
-
- gov.aps.jca.event.QueuedEventDispatcher
-
- All Implemented Interfaces:
Configurable,EventDispatcher,Runnable
public class QueuedEventDispatcher extends AbstractEventDispatcher implements Runnable, Configurable
This EventDispatcher uses an internal thread to dispatch events.- Version:
- 1.0
- Author:
- Eric Boucher
-
-
Field Summary
Fields Modifier and Type Field Description protected static int_countprotected Thread_dispatcherThreadprotected boolean_killedprotected int_limitprotected int_priorityprotected List_queueprotected int_queueLimitprotected Map_sourcesEventCount
-
Constructor Summary
Constructors Constructor Description QueuedEventDispatcher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(Configuration conf)Pass theConfigurationto theConfigurableclass.voiddispatch(AccessRightsEvent ev, AccessRightsListener arl)voiddispatch(AccessRightsEvent ev, List listeners)voiddispatch(ConnectionEvent ev, ConnectionListener cl)voiddispatch(ConnectionEvent ev, List listeners)voiddispatch(ContextExceptionEvent ev, ContextExceptionListener cel)voiddispatch(ContextExceptionEvent ev, List listeners)voiddispatch(ContextMessageEvent ev, ContextMessageListener cml)voiddispatch(ContextMessageEvent ev, List listeners)voiddispatch(GetEvent ev, GetListener gl)voiddispatch(GetEvent ev, List listeners)voiddispatch(MonitorEvent ev, MonitorListener ml)voiddispatch(MonitorEvent ev, List listeners)voiddispatch(PutEvent ev, PutListener pl)voiddispatch(PutEvent ev, List listeners)voiddispose()intgetPriority()protected voidnonBlockingQueueEvent(gov.aps.jca.event.QueuedEventDispatcher.Event ev)protected voidqueueEvent(gov.aps.jca.event.QueuedEventDispatcher.Event ev)protected voidqueueEvent(gov.aps.jca.event.QueuedEventDispatcher.Event ev, boolean doNotBlockRequired)voidrun()Process events in the queue as they are added.voidsetPriority(int priority)
-
-
-
Field Detail
-
_count
protected static int _count
-
_killed
protected volatile boolean _killed
-
_priority
protected int _priority
-
_dispatcherThread
protected Thread _dispatcherThread
-
_queue
protected List _queue
-
_queueLimit
protected int _queueLimit
-
_sourcesEventCount
protected Map _sourcesEventCount
-
_limit
protected int _limit
-
-
Method Detail
-
nonBlockingQueueEvent
protected void nonBlockingQueueEvent(gov.aps.jca.event.QueuedEventDispatcher.Event ev)
-
queueEvent
protected void queueEvent(gov.aps.jca.event.QueuedEventDispatcher.Event ev)
-
queueEvent
protected void queueEvent(gov.aps.jca.event.QueuedEventDispatcher.Event ev, boolean doNotBlockRequired)
-
run
public void run()
Process events in the queue as they are added. The queue must be synchronized for thread safety but we must be careful not to block for too long or else new events get blocked from being added to the queue causing long delays. The design is to process events in batches. This allows for the most efficient use of computer cycles since much of the time the queue will not be blocked. This method was modified by tap on 6/17/2004 to allow both efficient event processing and thread safety. Later optimized by msekoranja.
-
dispose
public void dispose()
- Specified by:
disposein interfaceEventDispatcher- Overrides:
disposein classAbstractEventDispatcher
-
configure
public void configure(Configuration conf) throws ConfigurationException
Description copied from interface:ConfigurablePass theConfigurationto theConfigurableclass. This method must always be called after the constructor and before any other method.- Specified by:
configurein interfaceConfigurable- Parameters:
conf- the class configurations.- Throws:
ConfigurationException- if an error occurs
-
getPriority
public int getPriority()
-
setPriority
public void setPriority(int priority)
-
dispatch
public void dispatch(ContextMessageEvent ev, List listeners)
- Specified by:
dispatchin interfaceEventDispatcher
-
dispatch
public void dispatch(ContextExceptionEvent ev, List listeners)
- Specified by:
dispatchin interfaceEventDispatcher
-
dispatch
public void dispatch(ConnectionEvent ev, List listeners)
- Specified by:
dispatchin interfaceEventDispatcher
-
dispatch
public void dispatch(AccessRightsEvent ev, List listeners)
- Specified by:
dispatchin interfaceEventDispatcher
-
dispatch
public void dispatch(MonitorEvent ev, List listeners)
- Specified by:
dispatchin interfaceEventDispatcher
-
dispatch
public void dispatch(GetEvent ev, List listeners)
- Specified by:
dispatchin interfaceEventDispatcher
-
dispatch
public void dispatch(PutEvent ev, List listeners)
- Specified by:
dispatchin interfaceEventDispatcher
-
dispatch
public void dispatch(ContextMessageEvent ev, ContextMessageListener cml)
- Specified by:
dispatchin interfaceEventDispatcher- Overrides:
dispatchin classAbstractEventDispatcher
-
dispatch
public void dispatch(ContextExceptionEvent ev, ContextExceptionListener cel)
- Specified by:
dispatchin interfaceEventDispatcher- Overrides:
dispatchin classAbstractEventDispatcher
-
dispatch
public void dispatch(ConnectionEvent ev, ConnectionListener cl)
- Specified by:
dispatchin interfaceEventDispatcher- Overrides:
dispatchin classAbstractEventDispatcher
-
dispatch
public void dispatch(AccessRightsEvent ev, AccessRightsListener arl)
- Specified by:
dispatchin interfaceEventDispatcher- Overrides:
dispatchin classAbstractEventDispatcher
-
dispatch
public void dispatch(MonitorEvent ev, MonitorListener ml)
- Specified by:
dispatchin interfaceEventDispatcher- Overrides:
dispatchin classAbstractEventDispatcher
-
dispatch
public void dispatch(GetEvent ev, GetListener gl)
- Specified by:
dispatchin interfaceEventDispatcher- Overrides:
dispatchin classAbstractEventDispatcher
-
dispatch
public void dispatch(PutEvent ev, PutListener pl)
- Specified by:
dispatchin interfaceEventDispatcher- Overrides:
dispatchin classAbstractEventDispatcher
-
-