X-Git-Url: https://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=blobdiff_plain;f=org.argeo.init%2Fsrc%2Forg%2Fargeo%2Finit%2Fosgi%2FAdminThread.java;fp=org.argeo.init%2Fsrc%2Forg%2Fargeo%2Finit%2Fosgi%2FAdminThread.java;h=0000000000000000000000000000000000000000;hp=e493e2c7e0d7621a33ccd73ef12633b93b9d997a;hb=b95462873703848193e56fcbe997693630db6121;hpb=55d88fba80cec198a0f11ba7545e19878c51fc5e diff --git a/org.argeo.init/src/org/argeo/init/osgi/AdminThread.java b/org.argeo.init/src/org/argeo/init/osgi/AdminThread.java deleted file mode 100644 index e493e2c7e..000000000 --- a/org.argeo.init/src/org/argeo/init/osgi/AdminThread.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.argeo.init.osgi; - -import java.io.File; - -import org.osgi.framework.BundleContext; -import org.osgi.framework.launch.Framework; - -/** Monitors the runtime and can shut it down. */ -@Deprecated -public class AdminThread extends Thread { - public final static String PROP_ARGEO_OSGI_SHUTDOWN_FILE = "argeo.osgi.shutdownFile"; - private File shutdownFile; - private final BundleContext bundleContext; - - public AdminThread(BundleContext bundleContext) { - super("OSGi Boot Admin"); - this.bundleContext = bundleContext; - if (System.getProperty(PROP_ARGEO_OSGI_SHUTDOWN_FILE) != null) { - shutdownFile = new File( - System.getProperty(PROP_ARGEO_OSGI_SHUTDOWN_FILE)); - if (!shutdownFile.exists()) { - shutdownFile = null; - OsgiBootUtils.warn("Shutdown file " + shutdownFile - + " not found, feature deactivated"); - } - } - } - - public void run() { - if (shutdownFile != null) { - // wait for file to be removed - while (shutdownFile.exists()) { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - Framework framework = (Framework) bundleContext.getBundle(0); - try { - // shutdown framework - framework.stop(); - // wait 10 mins for shutdown - framework.waitForStop(10 * 60 * 1000); - // close VM - System.exit(0); - } catch (Exception e) { - e.printStackTrace(); - System.exit(1); - } - } - } -}