Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.shutdowntimeout
Class ShutdownTimeout

java.lang.Object
  extended by net.java.sip.communicator.impl.shutdowntimeout.ShutdownTimeout
All Implemented Interfaces:
org.osgi.framework.BundleActivator

public class ShutdownTimeout
extends Object
implements org.osgi.framework.BundleActivator

In order to shut down SIP Communicator we kill the Felix system bundle. However, this sometimes doesn't work for reason of running non-daemon threads (such as the javasound event dispatcher). This results in having instances of SIP Communicator running in the background. We use this shutdown timout bundle in order to fix this problem. When our stop method is called, we assume that a shutdown is executed and start a 15 seconds daemon thread. If the application is still running once these 15 seconds expire, we System.exit() the application.

Author:
Emil Ivov

Field Summary
static long SHUTDOWN_TIMEOUT
          The number of miliseconds that we wait before we force a shutdown.
static int SYSTEM_EXIT_CODE
          The code that we exit with if the application is not down in 15 seconds.
 
Constructor Summary
ShutdownTimeout()
           
 
Method Summary
 void start(org.osgi.framework.BundleContext context)
          Dummy impl of the bundle activator start method.
 void stop(org.osgi.framework.BundleContext context)
          Called when this bundle is stopped so the Framework can perform the bundle-specific activities necessary to stop the bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHUTDOWN_TIMEOUT

public static final long SHUTDOWN_TIMEOUT
The number of miliseconds that we wait before we force a shutdown.

See Also:
Constant Field Values

SYSTEM_EXIT_CODE

public static final int SYSTEM_EXIT_CODE
The code that we exit with if the application is not down in 15 seconds.

See Also:
Constant Field Values
Constructor Detail

ShutdownTimeout

public ShutdownTimeout()
Method Detail

start

public void start(org.osgi.framework.BundleContext context)
           throws Exception
Dummy impl of the bundle activator start method.

Specified by:
start in interface org.osgi.framework.BundleActivator
Parameters:
context - unused
Throws:
Exception - If this method throws an exception (which won't happen).

stop

public void stop(org.osgi.framework.BundleContext context)
          throws Exception
Called when this bundle is stopped so the Framework can perform the bundle-specific activities necessary to stop the bundle.

Specified by:
stop in interface org.osgi.framework.BundleActivator
Parameters:
context - The execution context of the bundle being stopped.
Throws:
Exception - If this method throws an exception, the bundle is still marked as stopped, and the Framework will remove the bundle's listeners, unregister all services registered by the bundle, and release all services used by the bundle.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.