Bookmark Topic Watch Topic
  • New Topic

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

 
Shailesh Sukare
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Report post to moderator
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 ]
 
David BalaĹžic
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 20493
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please Use One Thread Per Question. Let's continue in this one.
 
    Bookmark Topic Watch Topic
  • New Topic