wood burning stoves 2.0*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
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: 86
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: 19651
    
  18

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


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
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
How to restrict execution of same class from two different consoles at same time?
application to get remote users information
Order in which class is searched