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 | 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: 19693
    
  20

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to restrict execution of same class from two different consoles at same time?