summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-11-02 17:11:29 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-11-02 17:11:29 +0000
commitba1bcc3ca8abd9a14ba185bb4f7bc95460336c3a (patch)
tree1fcbc628696ab2e8c8b2db7cc0c4f7c320039dce /java
parent15649e66488b68f46219fff6f4878c31b61015aa (diff)
Only stop the bundle if it is started by the provider
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@831974 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java b/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java
index 5744d7336f..9111a7d03c 100644
--- a/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java
+++ b/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java
@@ -64,6 +64,7 @@ public class OSGiImplementationProvider implements ImplementationProvider {
private RuntimeComponent component;
private ProxyFactoryExtensionPoint proxyFactoryExtensionPoint;
private Bundle osgiBundle;
+ private boolean startedByMe;
private OSGiImplementation implementation;
private List<ServiceRegistration> registrations = new ArrayList<ServiceRegistration>();
private OSGiImplementationFactory implementationFactory;
@@ -89,6 +90,7 @@ public class OSGiImplementationProvider implements ImplementationProvider {
int state = osgiBundle.getState();
if ((state & Bundle.STARTING) == 0 && (state & Bundle.ACTIVE) == 0) {
osgiBundle.start();
+ startedByMe = true;
}
} catch (BundleException e) {
throw new ServiceRuntimeException(e);
@@ -157,13 +159,18 @@ public class OSGiImplementationProvider implements ImplementationProvider {
}
}
registrations.clear();
- try {
- int state = osgiBundle.getState();
- if ((state & Bundle.STOPPING) == 0 && (state & Bundle.ACTIVE) != 0) {
- osgiBundle.stop();
+ // [REVIEW] Shoud it take care of stopping the bundle?
+ if (startedByMe) {
+ try {
+ int state = osgiBundle.getState();
+ if ((state & Bundle.STOPPING) == 0 && (state & Bundle.ACTIVE) != 0) {
+ osgiBundle.stop();
+ }
+ } catch (BundleException e) {
+ throw new ServiceRuntimeException(e);
+ } finally {
+ startedByMe = false;
}
- } catch (BundleException e) {
- throw new ServiceRuntimeException(e);
}
}