Re: XMPP Java bot loop question



On Tue, 31 Jul 2007 12:58:27 +0100, Sabine Dinis Blochberger
<no.spam@xxxxxxxxxxxx> wrote, quoted or indirectly quoted someone who
said :

How would I wait for those events and have the application keep
executing? I am a bit clueless aobut threads in Java, but I have used
them in Delphi...

If the system sends you events when things happen, there is no need
for you to do anything while you wait. When you get an event, deal
with it quickly, or you must spawn a thread to deal with it over an
extended period of time. Until you return from the event handler, the
GUI will be unresponsive.

If you need to periodically wake up and sniff around doing something
then go back to sleep, use a Timer see
http://mindprod.com/jgloss/timer.html or a sleeping background Thread.
See http://mindprod.com/jgloss/thread.html


It is unlikely you need to continuously compute something in the
background, so it unlikely you will need threads.

--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.