Menu

#2 preventing concurrent instances of started program

1.0
open
core (2)
5
2013-01-10
2003-03-25
No

Hello,

it would be very nice if you could give me a hint for
the following problem:

I have a plain normal class X (no inheritance) with a
plain normal main() method that is started periodically
from jcrontab. However, the code run from main()
sometimes runs very long (which is perfectly ok), with
the effect that jcrontab starts a new instance of X
while the old has not finished yet.

Is there anything in jcrontab that I could use in class
X to see if there is already an instance of X running
so that I can let X terminate silently and have only
one instance of X running at a time? Maybe I can inhert
from some jcrontab class that provides a method?
I'd like to avoid a solution based on lockfiles or
scanning the process table or anything like that.

Thanks a lot for your help.

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.