[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-distro-pkg-dev
Subject:    [RFC] Netx: make the single instance server thread a daemon
From:       dbhole () redhat ! com (Deepak Bhole)
Date:       2010-06-29 18:07:48
Message-ID: 20100629180748.GE25837 () redhat ! com
[Download RAW message or body]

* Omair Majid <omajid at redhat.com> [2010-06-22 14:22]:
> Hi,
> 
> The attached thread makes the single instance server thread in Netx
> a daemon thread. This allows the JVM to shutdown even if the server
> is the only thread running. The unexpected shutdown of the server
> should not cause any problems - the only cleanup the server does is
> shutting down the port.
> 
> Ok to commit?
> 

Yep, looks good to me. please go ahead and commit.

Cheers,
Deepak

> Cheers,
> Omair

> diff -r 507d3308f9c9 netx/net/sourceforge/jnlp/services/XSingleInstanceService.java
> --- a/netx/net/sourceforge/jnlp/services/XSingleInstanceService.java	Tue Jun 22 18:15:40 2010 +0100
> +++ b/netx/net/sourceforge/jnlp/services/XSingleInstanceService.java	Tue Jun 22 14:14:21 2010 -0400
> @@ -145,14 +145,21 @@
>      }
>  
>      /**
> -     * Start the listening server to accept arguments from new isntances of
> +     * Start the listening server to accept arguments from new instances of
>       * applications
>       * 
>       * @param lockFile
> +     *            the {@link SingleInstanceLock} that the server should use
>       */
>      private void startListeningServer(SingleInstanceLock lockFile) {
>          SingleInstanceServer server = new SingleInstanceServer(lockFile);
> -        new Thread(server).start();
> +        Thread serverThread = new Thread(server);
> +        /* 
> +         * mark as daemon so the JVM can shutdown if the server is the only
> +         * thread running
> +         */
> +        serverThread.setDaemon(true);
> +        serverThread.start();
>      }
>  
>      /**


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic