events and threads

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.
 
J

John McGrath

i'd like to do the following. I have two classes that implement
Runnable, ThreadA and ThreadB. ....

I already answered his question in the comp.lang.java.help newsgroup.
Multiposting is generally frowned on, so please do not do it. Thanks.
 
T

Thomas G. Marshall

Matt Humphrey coughed up:
Both are active. .help is more for beginners and .programmer is more
for advanced topics.

Cheers,
Matt Humphrey (e-mail address removed) http://www.iviz.com/


This is how it seems to be accepted, which is fine, but I don't mind if
people don't realize this. After all, the published "official" big-8
newsgroup list does not say this in the group description at all.

The description for comp.lang.java.help is:

"Set-up problems, catch-all first aid."

It does *not* say (perhaps it should, perhaps not):

"Set-up problems, beginner questions"

Here are the java groups with descriptions, as posted monthly in
news.announce.newgroups, under the subject "List of Big Eight Newsgroups":

http://groups-beta.google.com/group...fa272cf2cbb/1edfac4b68b6de8c#1edfac4b68b6de8c


comp.lang.java.3d 3D Graphics API's for the Java language.
comp.lang.java.advocacy Support for and criticism of the Java System.
comp.lang.java.announce Announcements re the Java System. (Moderated)
comp.lang.java.beans Java software components (JavaBeans).
comp.lang.java.corba Topics relating to Java and CORBA.
comp.lang.java.databases Databases, java.sql, JDBC, ODBC.
comp.lang.java.gui GUI toolkits and windowing: AWT, IFC etc.
*comp.lang.java.help* Set-up problems, catch-all first aid.
comp.lang.java.machine JVM, native methods, hardware.
comp.lang.java.programmer Programming in the Java language.
comp.lang.java.security Security issues raised by Java.
comp.lang.java.softwaretools IDEs, browsers, compilers, other tools.

Note the mispelling of "JFC" in c.l.j.gui :)

--
Unix users who vehemently argue that the "ln" command has its arguments
reversed do not understand much about the design of the utilities. "ln
arg1 arg2" sets the arguments in the same order as "mv arg1 arg2".
Existing file argument to non-existing argument. And in fact, mv
itself is implemented as a link followed by an unlink.
 
C

Chris Smith

Thomas said:
This is how it seems to be accepted, which is fine, but I don't mind if
people don't realize this. After all, the published "official" big-8
newsgroup list does not say this in the group description at all.

Indeed. If you carefully read the charters, you'll notice that .help is
supposedly only vaguely appropriate for programming questions, and
mainly for setup/installation problems. The main problem here is that
charters can not be changed, so we're stuck with what Peter van der
Linden came up with back in 1997. (This also explains clj.gui's
inclusion of IFC, but not the newer JFC.)

Two conclusions:

1. Usage needs to be defined by group concensus, not by the charter or
description of the groups when they were created.

2. Because no one has authority on the usage of the groups, being a
netcop on topicality between the groups just makes one look silly.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
T

Thomas G. Marshall

Chris Smith coughed up:
Indeed. If you carefully read the charters, you'll notice that .help
is supposedly only vaguely appropriate for programming questions, and
mainly for setup/installation problems. The main problem here is that
charters can not be changed, so we're stuck with what Peter van der
Linden came up with back in 1997. (This also explains clj.gui's
inclusion of IFC, but not the newer JFC.)

Two conclusions:

1. Usage needs to be defined by group concensus, not by the charter or
description of the groups when they were created.

Almost. Believe me, I'm not one of the usenet nazi's. But the charter as
applicable to group descriptions /is/ done by vote, which is a consensus of
sorts. The problem with having it be common usage dictated is the
following:

1. people continually educate others (often way too emphatically) about
reading the charters and reading descriptions to find the right group for
their posts.

2. the same people who holler at people for posting in the wrong place
are the same /types/ of people that holler at people for not posting
beginner quotes into .help.

In other words, if there is a description, it really oughtta be "right".
How "right" is determined, be it common usage or pretended fiat, is not my
concern.

2. Because no one has authority on the usage of the groups, being a
netcop on topicality between the groups just makes one look silly.

I agree. (I hope you weren't fingering me in that). The problem is that
there isn't the following, which is desperately needed:

comp.lang.java.beginner

I've promised to myself to go through the hoopla of requesting that group,
but have since found a million other things to do.

The other *HUGE* problem, IMO, is that the retired newsgroups are not
retired in most places. There really should be monthly postings in
comp.lang.java for example:

Subject: This newsgroup has been retired.

<content>
The official ng's are now. Please don't post in comp.lang.java, but find a
suitable alternative:

comp.lang.java.3d 3D Graphics API's for the Java language.
comp.lang.java.advocacy Support for and criticism of the Java System.
(etc.)
</content>

What makes this a huge problem IMO is that retired ng's tend to suck the
life out of non-retired groups by placing posts into a void where many of
the folks that know better do not venture.
 
L

Lee Fesperman

Thomas said:
The other *HUGE* problem, IMO, is that the retired newsgroups are not
retired in most places. There really should be monthly postings in
comp.lang.java for example:

Subject: This newsgroup has been retired.

<content>
...

Are you volunteering? You did say it was a *HUGE* (double emphasis) problem ;^)

You know: everyone complains about the weather, but nobody does anything about it.
 
T

Thomas G. Marshall

Lee Fesperman coughed up:
Are you volunteering? You did say it was a *HUGE* (double emphasis)
problem ;^)

You know: everyone complains about the weather, but nobody does
anything about it.


Such postings should really be automated, and automated postings are
suitable fodder for abuse complaints out the wazoo.

If you think it'd help, I'll be glad to post something like that once in a
while. Do you think it would be well received? Or would I condemned as a
self appointed ruler...
 
L

Lee Fesperman

Thomas said:
Lee Fesperman coughed up:

Such postings should really be automated, and automated postings are
suitable fodder for abuse complaints out the wazoo.

If you think it'd help, I'll be glad to post something like that once in a
while. Do you think it would be well received? Or would I condemned as a
self appointed ruler...

I have to say it does bother me too, so I'd say go ahead if you're a mind. I won't worry
about reactions from the somewhat clueless ones that post there. You should have a
fairly thick skin from posting here ;^)

Thinking about it, what bothers me more is those who answer questions there. I've never
checked, but apparently some do that. Maybe your posting will get them to see the light
too, or maybe they like having their own little pond.
 
T

Thomas G. Marshall

Lee Fesperman coughed up:
I have to say it does bother me too, so I'd say go ahead if you're a
mind. I won't worry about reactions from the somewhat clueless ones
that post there. You should have a fairly thick skin from posting
here ;^)

lol. Yep.

Ok, done. Let'm bring it on. This is the message:

<QUOTE>

(Subject: *NOTE* This is a RETIRED java newsgroup. Please redirect.)

This message is sent to these newsgroups because they are no longer valid:

comp.lang.java
comp.lang.java.api
comp.lang.java.bugs
comp.lang.java.misc
comp.lang.java.setup
comp.lang.java.tech

These are long since retired newsgroups. You may have ended up in one by
posting on google groups, or verizon, or any number of ISP's that still
carry them (and should not). You will get a far better audience by
redirecting your future posts to one of the "officially active" newsgroups
below.

Here are the java groups with descriptions, as posted monthly in
news.announce.newgroups, under the subject "List of Big Eight Newsgroups":

http://groups-beta.google.com/group...fa272cf2cbb/1edfac4b68b6de8c#1edfac4b68b6de8c


comp.lang.java.3d 3D Graphics API's for the Java language.
comp.lang.java.advocacy Support for and criticism of the Java System.
comp.lang.java.announce Announcements re the Java System. (Moderated)
comp.lang.java.beans Java software components (JavaBeans).
comp.lang.java.corba Topics relating to Java and CORBA.
comp.lang.java.databases Databases, java.sql, JDBC, ODBC.
comp.lang.java.gui GUI toolkits and windowing: AWT, IFC etc.
comp.lang.java.help Set-up problems, catch-all first aid.
comp.lang.java.machine JVM, native methods, hardware.
comp.lang.java.programmer Programming in the Java language.
comp.lang.java.security Security issues raised by Java.
comp.lang.java.softwaretools IDEs, browsers, compilers, other tools.

</QUOTE>
 
L

Lee Fesperman

Thomas said:
Lee Fesperman coughed up:

lol. Yep.

Ok, done. Let'm bring it on. This is the message:

<QUOTE>

(Subject: *NOTE* This is a RETIRED java newsgroup. Please redirect.)

This message is sent to these newsgroups because they are no longer valid:

comp.lang.java
comp.lang.java.api
comp.lang.java.bugs
comp.lang.java.misc
comp.lang.java.setup
comp.lang.java.tech

These are long since retired newsgroups. You may have ended up in one by
posting on google groups, or verizon, or any number of ISP's that still
carry them (and should not). You will get a far better audience by
redirecting your future posts to one of the "officially active" newsgroups
below.

Here are the java groups with descriptions, as posted monthly in
news.announce.newgroups, under the subject "List of Big Eight Newsgroups":

http://groups-beta.google.com/group...fa272cf2cbb/1edfac4b68b6de8c#1edfac4b68b6de8c

comp.lang.java.3d 3D Graphics API's for the Java language.
comp.lang.java.advocacy Support for and criticism of the Java System.
comp.lang.java.announce Announcements re the Java System. (Moderated)
comp.lang.java.beans Java software components (JavaBeans).
comp.lang.java.corba Topics relating to Java and CORBA.
comp.lang.java.databases Databases, java.sql, JDBC, ODBC.
comp.lang.java.gui GUI toolkits and windowing: AWT, IFC etc.
comp.lang.java.help Set-up problems, catch-all first aid.
comp.lang.java.machine JVM, native methods, hardware.
comp.lang.java.programmer Programming in the Java language.
comp.lang.java.security Security issues raised by Java.
comp.lang.java.softwaretools IDEs, browsers, compilers, other tools.

</QUOTE>

Nicely put. It was a great idea to hit them all at once, Thomas.

It's got my approval. Anyone else want to chime in?
 
T

Thomas G. Marshall

Lee Fesperman coughed up:
Nicely put. It was a great idea to hit them all at once, Thomas.

Actually, there's two I cannot hit unless I go through google: developer and
javascript----I'll do that soon. Javascript should be
comp.lang.javascript, not comp.lang.java.javascript, which is there in
google.
 
C

Chris Smith

Thomas said:
Actually, there's two I cannot hit unless I go through google: developer and
javascript----I'll do that soon. Javascript should be
comp.lang.javascript, not comp.lang.java.javascript, which is there in
google.

For the record, comp.lang.java.javascript was a group for discussing
communication between Java and JavaScript; different from
comp.lang.javascript, which has nothing to do with Java at all.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
T

Thomas G. Marshall

Chris Smith coughed up:
For the record, comp.lang.java.javascript was a group for discussing
communication between Java and JavaScript; different from
comp.lang.javascript, which has nothing to do with Java at all.

Ok, but it's not on the list. I'm starting to feel like senator mccarthy.
I'll leave it out.

By the way, is there /no/ way to have an obfuscated email address with
google?

--
Puzzle: You are given a deck of cards all face up
except for 10 cards mixed in which are face down.
If you are in a pitch black room, how do you divide
the deck into two piles (may be uneven) that each
contain the same number of face-up cards?
Answer (rot13): Sebz naljurer va gur qrpx, qrny bhg
gra pneqf naq syvc gurz bire.
 
T

Thomas Weidenfeller

Thomas said:
comp.lang.java.gui GUI toolkits and windowing: AWT, IFC etc. [...]
Note the mispelling of "JFC" in c.l.j.gui :)

Thats not a misspelling. IFC = Netscape's Internet Foundation Classes.
At the time of the group's creation that was considered the best
candidate for an AWT successor. IFC, like other technologies became
input to the JFC, and the IFC was a base for Swing. Other stuff that
went into the JFC was technology from Taligent, which became the Java 2D
API.

The short description just shows the age of the group.

/Thomas
 
M

Matt Humphrey

Thomas G. Marshall said:
Chris Smith coughed up:

Ok, but it's not on the list. I'm starting to feel like senator mccarthy.
I'll leave it out.

By the way, is there /no/ way to have an obfuscated email address with
google?

--
Puzzle: You are given a deck of cards all face up
except for 10 cards mixed in which are face down.
If you are in a pitch black room, how do you divide
the deck into two piles (may be uneven) that each
contain the same number of face-up cards?
Answer (rot13): Sebz naljurer va gur qrpx, qrny bhg
gra pneqf naq syvc gurz bire.

Off topic (well, not much more than the current discussion)

Are you sure your puzzle is correct with respect to your answer? Shouldn't
the request be for the same number of face-down cards in each pile, not
face-up cards? (Your answer is to deal 10 at random and flip them [the 10]
over. That gives an equal amount face-down in each pile. Dealing 10 at
random and flipping the remainder of the deck gives the same number face-up.
Or dealing 42 and flipping them [the 42] over gives the same number of
face-up.)

Cheers,
Matt Humphrey (e-mail address removed) http://www.iviz.com/
 
T

Thomas G. Marshall

Matt Humphrey coughed up:
"Thomas G. Marshall"
Chris Smith coughed up:

Ok, but it's not on the list. I'm starting to feel like senator
mccarthy. I'll leave it out.

By the way, is there /no/ way to have an obfuscated email address
with google?

--
Puzzle: You are given a deck of cards all face up
except for 10 cards mixed in which are face down.
If you are in a pitch black room, how do you divide
the deck into two piles (may be uneven) that each
contain the same number of face-up cards?
Answer (rot13): Sebz naljurer va gur qrpx, qrny bhg
gra pneqf naq syvc gurz bire.

Off topic (well, not much more than the current discussion)

Are you sure your puzzle is correct with respect to your answer?
Shouldn't the request be for the same number of face-down cards in
each pile, not face-up cards? (Your answer is to deal 10 at random
and flip them [the 10] over. That gives an equal amount face-down in
each pile. Dealing 10 at random and flipping the remainder of the
deck gives the same number face-up. Or dealing 42 and flipping them
[the 42] over gives the same number of face-up.)

Cheers,
Matt Humphrey (e-mail address removed) http://www.iviz.com/

YES! In my [unbelievablystupiddumbass] haste, I mistyped. THANKS!!!!!!
 
T

Thomas G. Marshall

Matt Humphrey coughed up:

....[rip]...

Are you sure your puzzle is correct with respect to your answer?

thanks again.

....[rip]...

--
Puzzle: You are given a deck of cards all face down
except for 10 cards mixed in which are face up.
If you are in a pitch black room, how do you divide
the deck into two piles (may be uneven) that each
contain the same number of face-up cards?
Answer (rot13): Sebz naljurer va gur qrpx, qrny bhg
gra pneqf naq syvc gurz bire.
 
T

Thomas G. Marshall

Lee Fesperman coughed up:

....[rip]...
Nicely put. It was a great idea to hit them all at once, Thomas.

It's got my approval. Anyone else want to chime in?


Well Lee, as I (we?) predicted, there were a couple of angry knee-jerk
reactions to the post in comp.lang.java. The first person seemed to
understand after some back and forth, the 2nd guy was just, well, off the
wall. It's a pretty sad set of posts he made actually. He argued so poorly
that I actually am in the weird position of feeling bad for him.

Actually, this is not my prediction really: I was expecting something more
like 10-20 death threats. So I'm fairly pleased with the outcome. I figure
I'll post a few more from time to time. Beats me if it'll have any real
effect---but maybe at least a person here or there will learn how to find
the right groups.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Javefx and events 1
trouble with sound in J2ME 1
Listing events not showing when date is today. 4
meaning of synchronized keyword 16
how to multithread using c++ 8
Signals and threads 2
Threads 5
threads and GUIs 18

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top