 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jova Guest
|
Posted: Sun Oct 15, 2006 8:57 pm Post subject: Thread question |
|
|
I have a client running and it implemenets Runnable, I want it to connect
to a server at certain time intervals to retrieve data. How can this be
accomplished? |
|
| Back to top |
|
 |
Matt Humphrey Guest
|
Posted: Sun Oct 15, 2006 11:35 pm Post subject: Re: Thread question |
|
|
"Jova" <jova (AT) nospam (DOT) net> wrote in message
news:TTsYg.3962$ON3.186 (AT) newsfe10 (DOT) lga...
| Quote: | I have a client running and it implemenets Runnable, I want it to connect
to a server at certain time intervals to retrieve data. How can this be
accomplished?
|
The fact that it implements Runnable doesn't necessarily mean anything here.
To have your client periodically connect to a server look at
java.util.Timer. Have the timer execute a timer task that does your client
connection operation. This may in turn require a Runnable, but it doesn't
have to be (and is probably best if it is not) a Runnable of your client.
Don't forget that you will probably need some kind of synchronization such
that when the task is executing, it doesn't conflict with whatever else the
client may be doing.
Matt Humphrey matth (AT) ivizNOSPAM (DOT) com http://www.iviz.com / |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|