|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.prosyst.mbs.framework.event.EventThread
public abstract class EventThread
Abstract class for asynchronous event dispatching
| Field Summary | |
|---|---|
java.lang.Object |
bad
The last callbacked listener. |
protected java.lang.String |
baseName
|
protected int |
counter
Instancies counter. |
protected java.lang.Object |
element
The event to be dispatched |
protected java.lang.ThreadGroup |
group
|
protected java.lang.String |
name
|
protected Queue |
queue
The event queue. |
protected int |
state
The state of the thread. |
protected java.lang.Thread |
thread
|
protected long |
time
The time spent in the current callback, or 0 if the thread is not in a callback |
| Constructor Summary | |
|---|---|
protected |
EventThread(EventThread old)
Constructs a new EventThread, after the old event thread has stopped responding |
|
EventThread(java.lang.ThreadGroup group,
java.lang.String name,
int size)
Constructs the first instance of the EventThread |
|
EventThread(java.lang.ThreadGroup group,
java.lang.String name,
Queue queue)
Constructs the first instance of the EventThread |
| Method Summary | |
|---|---|
void |
addEvent(java.lang.Object event,
boolean check)
Adds an event in the event queue. |
abstract boolean |
checkTime()
Checks if the thread is still active. |
java.lang.String |
getName()
|
java.lang.Thread |
getThread()
|
abstract int |
getThreadPriority()
Returns the desired thread priority. |
abstract void |
newEventDispatcher()
The method must create a new EventThread instance, using super.EventThread(this)
and start it. |
abstract void |
print(java.lang.Throwable t)
Logs the error. |
abstract void |
processEvent()
Performs the actual event delivery. |
void |
run()
Processes the event queue. |
void |
start()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public java.lang.Object bad
protected Queue queue
protected int state
protected long time
protected int counter
protected java.lang.Object element
protected java.lang.String baseName
protected java.lang.String name
protected java.lang.Thread thread
protected java.lang.ThreadGroup group
| Constructor Detail |
|---|
public EventThread(java.lang.ThreadGroup group,
java.lang.String name,
int size)
group - The ThreadGroup of the thread, or null for the current thread groupname - The base name of the thread. The counter value will
be added at the end of the string to construct the full name.size - The initial number of elements of the events queue
public EventThread(java.lang.ThreadGroup group,
java.lang.String name,
Queue queue)
group - The ThreadGroup of the thread, or null for the current thread groupname - The base name of the thread. The counter value will
be added at the end of the string to construct the full name.queue - The events queueprotected EventThread(EventThread old)
old event thread has stopped responding
old - The previous instance| Method Detail |
|---|
public void start()
public void addEvent(java.lang.Object event,
boolean check)
queue field.
event - The event to addcheck - If true, the method will check if the EventThread is still respondingpublic void run()
element
field and calls
run in interface java.lang.Runnablepublic java.lang.Thread getThread()
public java.lang.String getName()
public abstract int getThreadPriority()
public abstract void processEvent()
element
field. The method is supposed to perform the following for every listener:
queue check the state of the thread - if it si closed - return
bad and time
- callback
- set bad to null and time to 0
public abstract boolean checkTime()
time and bad
must be used. The method is called from the addEvent method - thus should be synchronizes on
the queue field outside and additional synchronization is not needed.
public abstract void newEventDispatcher()
super.EventThread(this)
and start it.
public abstract void print(java.lang.Throwable t)
t -
|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||