Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

241
Views
How to correctly prevent that an application is runned again untill a previous instance ends using lock file?

I am working on a simple Spring console application (it is a litle batch working on a database).

This batch is scheduled to start at specific time. The problem is that the execution of this program can take a lot of time and the scheduler can try to start it before the previous instance of this program completed its work.

So I think that I can use a lock file to handle this situation, my idea is:

  • When the batch start it check if there is this lock file in its folder (if this lock file is present, the batch application ends without doing anything).
  • If the lock file can't be found: create the lock file and start the batch operations.

Do you think that it could be a valid approach to the problem? Or Spring provide some smarter way?

Another doubt is: what is the standard for a lock file? Can I create simply a .lock file in the current folder?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!