diff options
author | Thomas Watson | 2017-01-19 14:21:26 +0000 |
---|---|---|
committer | Thomas Watson | 2017-01-19 14:21:26 +0000 |
commit | 83395839c881d4ed7604e825a38c7d1b6dd41119 (patch) | |
tree | faf0fab679c3138cf3cc9978f92039871d75901e | |
parent | 19cf1c68d5c5862b4f9681f3645de747779a3696 (diff) | |
download | rt.equinox.bundles-83395839c881d4ed7604e825a38c7d1b6dd41119.tar.gz rt.equinox.bundles-83395839c881d4ed7604e825a38c7d1b6dd41119.tar.xz rt.equinox.bundles-83395839c881d4ed7604e825a38c7d1b6dd41119.zip |
Bug 510673 - Set ds.delayed.keepInstances true by defaultY20170119-1000I20170119-1010
This is done in code and as a p2 instruction. The p2 instruction is a
safe guard when provisioned with p2 so that we ensure the property is
set in the config.ini such that it will be enabled at boot with no
chance of being missed by felix SCR if it happens to start before
equinox.ds.
Change-Id: I66dbec7b33b14bbc85e8d8d64d71e930106c415e
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rw-r--r-- | bundles/org.eclipse.equinox.ds/META-INF/p2.inf | 6 | ||||
-rw-r--r-- | bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/Activator.java | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.ds/META-INF/p2.inf b/bundles/org.eclipse.equinox.ds/META-INF/p2.inf index 2d407fa84..9dd8bfe1d 100644 --- a/bundles/org.eclipse.equinox.ds/META-INF/p2.inf +++ b/bundles/org.eclipse.equinox.ds/META-INF/p2.inf @@ -1,7 +1,9 @@ instructions.configure=\ - setProgramProperty(propName:equinox.use.ds, propValue:true); + setProgramProperty(propName:equinox.use.ds, propValue:true);\ + setProgramProperty(propName:ds.delayed.keepInstances, propValue:true); instructions.unconfigure=\ - setProgramProperty(propName:equinox.use.ds, propValue:); + setProgramProperty(propName:equinox.use.ds, propValue:);\ + setProgramProperty(propName:ds.delayed.keepInstances, propValue:); provides.0.namespace = osgi.extender provides.0.name = osgi.component provides.0.version = 1.2
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/Activator.java b/bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/Activator.java index d163ebd11..6c8e325c1 100644 --- a/bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/Activator.java +++ b/bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/Activator.java @@ -20,6 +20,8 @@ import org.osgi.framework.wiring.BundleWiring; public class Activator implements BundleActivator { + private Bundle scr; + public void start(BundleContext context) throws Exception { ServiceReference<EnvironmentInfo> envInfoRef = context.getServiceReference(EnvironmentInfo.class); EnvironmentInfo envInfo = null; @@ -27,9 +29,11 @@ public class Activator implements BundleActivator { envInfo = context.getService(envInfoRef); } if (envInfo != null) { + envInfo.setProperty("ds.delayed.keepInstances", "true"); //$NON-NLS-1$//$NON-NLS-2$ envInfo.setProperty("equinox.use.ds", "true"); //$NON-NLS-1$//$NON-NLS-2$ context.ungetService(envInfoRef); } else { + System.setProperty("ds.delayed.keepInstances", "true"); //$NON-NLS-1$//$NON-NLS-2$ System.setProperty("equinox.use.ds", "true"); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -38,18 +42,18 @@ public class Activator implements BundleActivator { if (required.isEmpty()) { throw new IllegalStateException("No org.apache.felix.scr bundle found!"); //$NON-NLS-1$ } - Bundle scr = required.get(0).getProvider().getBundle(); + scr = required.get(0).getProvider().getBundle(); if (!"org.apache.felix.scr".equals(scr.getSymbolicName())) { //$NON-NLS-1$ throw new IllegalStateException("Required wrong bundle: " + scr); //$NON-NLS-1$ } BundleStartLevel equinoxSDstartLevel = context.getBundle().adapt(BundleStartLevel.class); BundleStartLevel scrStartLevel = scr.adapt(BundleStartLevel.class); scrStartLevel.setStartLevel(equinoxSDstartLevel.getStartLevel()); - scr.start(); + scr.start(Bundle.START_TRANSIENT); } public void stop(BundleContext context) throws Exception { - // do nothing; just keep scr persistently started + scr.stop(Bundle.STOP_TRANSIENT); } } |