F
farseer
Hello,
i'd like to do the following. I have two classes that implement
Runnable, ThreadA and ThreadB. There may be many ThreadA instances,
but only one ThreadB instance. ThreadB will "fire" various events and
The ThreadA instance will listen for these events.
My questions are:
1) is this possible
2) How do i do this?
i know the following. I create an EventListener in ThreadA and it's
actionPerformed method will just add the Events to an ArrayList (i am
not worried about synchronization, since only the instance of ThreadA
will be modifying that ArrayList). The run method of ThreadA will
process the queue (ArrayList) as long as it's not empty.
THAT SAID, i am not sure how to register an event in this case? or do i
need to do that? If i fire an event from ThreadB, will any class that
has a listener method for that event be able to "catch" that event?
i guess i need some help in figuring out how to implement this
scenario, in particular, how to register the EventListener and whether
this will create problems since it's two threads..one firing the events
and one listening for the events?
thanks much.
i'd like to do the following. I have two classes that implement
Runnable, ThreadA and ThreadB. There may be many ThreadA instances,
but only one ThreadB instance. ThreadB will "fire" various events and
The ThreadA instance will listen for these events.
My questions are:
1) is this possible
2) How do i do this?
i know the following. I create an EventListener in ThreadA and it's
actionPerformed method will just add the Events to an ArrayList (i am
not worried about synchronization, since only the instance of ThreadA
will be modifying that ArrayList). The run method of ThreadA will
process the queue (ArrayList) as long as it's not empty.
THAT SAID, i am not sure how to register an event in this case? or do i
need to do that? If i fire an event from ThreadB, will any class that
has a listener method for that event be able to "catch" that event?
i guess i need some help in figuring out how to implement this
scenario, in particular, how to register the EventListener and whether
this will create problems since it's two threads..one firing the events
and one listening for the events?
thanks much.