Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Preventing two instances of the same application workbench
Preventing two instances of the same application workbench [message #445429] Wed, 01 March 2006 01:25 Go to next message
Peter Suen is currently offline Peter SuenFriend
Messages: 6
Registered: July 2009
Junior Member
Hi All,

Does anyone know how to prevent the user from starting up two instances of the same RCP application? I.e., when the user double-clicks the app's .exe, is there a way to check if an instance already exists? And if so, prevent a second instance from starting?

Thanks.
Re: Preventing two instances of the same application workbench [message #445466 is a reply to message #445429] Wed, 01 March 2006 10:02 Go to previous messageGo to next message
Phill Perryman is currently offline Phill PerrymanFriend
Messages: 214
Registered: July 2009
Senior Member
<br><font size=2 face="sans-serif">I have done it before (but not in eclipse).</font>
<br>
<br><font size=2 face="sans-serif">When your application starts check for
a file called .lock, if i exists then terminate, if it does not exist create
it.</font>
<br>
<br><font size=2 face="sans-serif">In the stop method of the application
delete the file.</font>
<br>
<br><font size=2 face="sans-serif">The problem with this is if the pc is
turned off then the delete never happens and so the app will never start
again.</font>
<br>
<br><font size=2 face="sans-serif">To get round this I had a background
task ( i did it every 30 seconds) run periodically and update the time
stamp on the file. Then update the startup code to check if the file exists
and also to make sure it is recent, if it is an old lock file then cary
on and start up.</font>
<br>
<br><font size=2 face="sans-serif">So if you get a catastrophic failure
at least the app will start again 30 seconds later, you can even advise
the user of this when terminating because you found the .lock file.</font>
Re: Preventing two instances of the same application workbench [message #447692 is a reply to message #445466] Wed, 12 April 2006 21:10 Go to previous message
Peter Suen is currently offline Peter SuenFriend
Messages: 6
Registered: July 2009
Junior Member
Thanks. This might be a suitable solution.
Previous Topic:Editor Filters
Next Topic:Visibility of file in plug-in to a plug-in it is dependent on?
Goto Forum:
  


Current Time: Mon Nov 04 15:40:14 GMT 2024

Powered by FUDForum. Page generated in 0.04820 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top