Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2006

Tip: Looking for answers? Try searching our database.

Starting and stopping a prog. from another prog.

Thread view: 
andoni.oconchubhair@ie.fid-intl.com - 22 Oct 2006 14:27 GMT
Hi,

I have a program (only 100 lines or less) that polls a web-service and
gives me the current status of the service. I want to run this program
on an infinite loop using Thread.sleep() to sleep for 5 mins. after
polling and have some way of starting and stopping it.

Can anyone tell me what I would have to do to achieve this?

I hve thought of having a "lock-file?". Basically just checking for the
existance of a file of a particular name and if it exists then breaking
out of the loop. Another way might be to spawn a thread which listens
for a keystroke using System.in but this would involve running the
program in the user-space only. I couldn't ever log off without
stopping the program.

So I'm sure there's a standard way that is much cleaner??

Thanks in advance for any suggestions,
Andoni.
Martin Gregorie - 22 Oct 2006 23:43 GMT
> Hi,
>
[quoted text clipped - 13 lines]
>
> So I'm sure there's a standard way that is much cleaner??

Listen on a socket for a datagram (UDP packet)? There may be simpler
ways but this way is at least OS agnostic.

Signature

martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.