aspose file tools
The moose likes Java in General and the fly likes How to restrict execution of same class from two different consoles at same time? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

How to restrict execution of same class from two different consoles at same time?

Shailesh Sukare
Greenhorn

Joined: Sep 04, 2008
Posts: 4
How to restrict execution of same class from two different consoles at same time???

I am facing one problem. I want only one instance of the class to be running on my OS. I have written one loader program and want to execute only one instance of loader at a time. If I execute the loader from one console and while the first loader is running I want to prevent execution of second loader from the another console.Is there any way to restrict the execution of same class from two different consoles.

[ September 05, 2008: Message edited by: Shailesh S. ]

[ September 05, 2008: Message edited by: Shailesh S. ]
[ September 05, 2008: Message edited by: Bear Bibeault ]

Thanks,<br />Shailesh S.
David Balažic
Ranch Hand

Joined: May 15, 2008
Posts: 83
You probably have to use a method as in all other languages.

For example creating a lock file in the filesystem.
(Study the procedure carefully, to avoid common mistakes !)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

Please Use One Thread Per Question. Let's continue in this one.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to restrict execution of same class from two different consoles at same time?
 
Similar Threads
Which of the following statements is correct regarding the servlets that implement
Sorting Collections Doubt
application to get remote users information
How to restrict execution of same class from two different consoles at same time?
Order in which class is searched