Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2010-11-29 19:31:31 +0000
committerThomas Watson2010-11-29 19:31:31 +0000
commit46cb432f6edb85b4c345c72f5ca72406183cc143 (patch)
tree4acb26bf378d13501bbc1a11e6af1bf0df38cb4a
parent3c83b3da9209194dd79a4cd12c4f4c29e554af35 (diff)
downloadrt.equinox.framework-46cb432f6edb85b4c345c72f5ca72406183cc143.tar.gz
rt.equinox.framework-46cb432f6edb85b4c345c72f5ca72406183cc143.tar.xz
rt.equinox.framework-46cb432f6edb85b4c345c72f5ca72406183cc143.zip
Bug 330905 - Problem with persisting bundles state after install when eclipse.stateSaveDelayInterval is set to 0
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java6
-rw-r--r--bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BaseStorage.java5
-rw-r--r--bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BundleInstall.java3
-rw-r--r--bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BundleUninstall.java10
-rw-r--r--bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BundleUpdate.java4
5 files changed, 20 insertions, 8 deletions
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java
index f557f100b..6f4c152a0 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java
@@ -948,8 +948,11 @@ public class Framework implements EventPublisher, Runnable {
throw e.getException();
}
}
+ // must add the bundle before committing (bug 330905)
+ bundles.add(bundle);
storage.commit(false);
} catch (Throwable error) {
+ bundles.remove(bundle);
synchronized (bundles) {
bundle.unload();
}
@@ -959,8 +962,7 @@ public class Framework implements EventPublisher, Runnable {
if (bundleStats != null)
bundleStats.watchBundle(bundle, BundleWatcher.END_INSTALLING);
}
- /* bundle has been successfully installed */
- bundles.add(bundle);
+
} catch (Throwable t) {
try {
storage.undo();
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BaseStorage.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BaseStorage.java
index 95adab0ab..b4c4041d7 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BaseStorage.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BaseStorage.java
@@ -1298,8 +1298,11 @@ public class BaseStorage implements SynchronousBundleListener {
synchronized (systemState) {
if (shutdown)
return; // do not start another thread if we have already shutdown
- if (delay_interval == 0) // all saves are atomic
+ if (delay_interval == 0) {
+ // all saves are atomic; never start a background thread
saveAllData(false);
+ return;
+ }
lastSaveTime = System.currentTimeMillis();
if (runningThread == null) {
shutdownHook = new Thread(new Runnable() {
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BundleInstall.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BundleInstall.java
index 0ffedb2fd..2aaa147e6 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BundleInstall.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BundleInstall.java
@@ -120,12 +120,13 @@ public class BundleInstall implements BundleOperation {
public void commit(boolean postpone) throws BundleException {
storage.processExtension(data, BaseStorage.EXTENSION_INSTALLED);
+ storage.updateState(data, BundleEvent.INSTALLED);
try {
data.save();
} catch (IOException e) {
throw new BundleException(AdaptorMsg.ADAPTOR_STORAGE_EXCEPTION, e);
}
- storage.updateState(data, BundleEvent.INSTALLED);
+
}
}
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BundleUninstall.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BundleUninstall.java
index 05d1fda15..83e1351aa 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BundleUninstall.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BundleUninstall.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,7 +11,7 @@
package org.eclipse.osgi.internal.baseadaptor;
-import java.io.*;
+import java.io.IOException;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.framework.adaptor.BundleData;
import org.eclipse.osgi.framework.adaptor.BundleOperation;
@@ -54,6 +54,12 @@ public class BundleUninstall implements BundleOperation {
storage.processExtension(data, BaseStorage.EXTENSION_UNINSTALLED);
data.setLastModified(System.currentTimeMillis());
storage.updateState(data, BundleEvent.UNINSTALLED);
+ data.setDirty(true);
+ try {
+ data.save();
+ } catch (IOException e) {
+ throw new BundleException(AdaptorMsg.ADAPTOR_STORAGE_EXCEPTION, e);
+ }
}
/**
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BundleUpdate.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BundleUpdate.java
index 455d51898..c33783c54 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BundleUpdate.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BundleUpdate.java
@@ -117,13 +117,13 @@ public class BundleUpdate implements BundleOperation {
public void commit(boolean postpone) throws BundleException {
storage.processExtension(data, BaseStorage.EXTENSION_UNINSTALLED); // remove the old extension
storage.processExtension(newData, BaseStorage.EXTENSION_UPDATED); // update to the new one
+ newData.setLastModified(System.currentTimeMillis()); // save the last modified
+ storage.updateState(newData, BundleEvent.UPDATED);
try {
- newData.setLastModified(System.currentTimeMillis());
newData.save();
} catch (IOException e) {
throw new BundleException(AdaptorMsg.ADAPTOR_STORAGE_EXCEPTION, e);
}
- storage.updateState(newData, BundleEvent.UPDATED);
BaseStorageHook oldStorageHook = (BaseStorageHook) data.getStorageHook(BaseStorageHook.KEY);
try {
oldStorageHook.delete(postpone, BaseStorageHook.DEL_GENERATION);

Back to the top