[izpack-devel] Single Installer Instance

Tino Schwarze berlios.de at tisc.de
Wed Jan 30 14:49:18 CET 2008


On Wed, Jan 30, 2008 at 09:22:40AM +0100, Bartz, Klaus wrote:

> > > > I haven't done this with Java.  I know Eclipse and some other 
> > > > applications do this, but was wondering if there was an 
> > easy way to 
> > > > implement it.  My experience has been that each Java application 
> > > > blindly launches in a new JVM with no way to check in an 
> > OS neutral 
> > > > way whether an instance of the same application is 
> > already running.
> > 
> > There doesn't seem to be a simple way to detect already 
> > running Java VMs. (Apart from using Sun's attach API from 
> > Java 1.6, but it's not official yet.)
> > 
> > > How about a lock/pid file?
> > 
> > Dangerous. Even if we use the deleteOnExit stuff, the lock 
> > may be left over somehow. 
> 
> May be the lock/pid file contains an expiry entry.

Good point. A keepalive thread in the installer could refresh the entry
every n seconds and we set deleteFileOnExit on the lock file. This
should be secure enough. So we only need a lock beside the installer's
JAR. Building the lock name from Appname etc. seems feasible too.

Tino.

-- 
www.craniosacralzentrum.de
www.spiritualdesign-chemnitz.de

Tino Schwarze * Lortzingstraße 21 * 09119 Chemnitz


More information about the izpack-devel mailing list