diff options
3 files changed, 18 insertions, 11 deletions
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/StateManager.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/StateManager.java index 5f491053e..0647a9123 100644 --- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/StateManager.java +++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/StateManager.java @@ -298,8 +298,11 @@ public class StateManager implements PlatformAdmin, Runnable { } catch (InterruptedException e) { return; } - if (systemState != null && timeStamp == systemState.getTimeStamp() && !systemState.dynamicCacheChanged()) - systemState.unloadLazyData(expireTime); + if (systemState != null) + synchronized (systemState) { + if (timeStamp == systemState.getTimeStamp() && !systemState.dynamicCacheChanged()) + systemState.unloadLazyData(expireTime); + } } } } diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java index ee45d3ce2..1ae157cbb 100644 --- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java @@ -446,14 +446,17 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle private void fullyLoad() { if ((stateBits & LAZY_LOADED) == 0) return; - if (isFullyLoaded()) { - containingState.getReader().setAccessedFlag(true); // set reader accessed flag + StateReader reader = containingState.getReader(); + synchronized (reader) { + if (isFullyLoaded()) { + reader.setAccessedFlag(true); // set reader accessed flag return; - } - try { - containingState.getReader().fullyLoad(this); - } catch (IOException e) { - throw new RuntimeException(e.getMessage()); // TODO not sure what to do here!! + } + try { + reader.fullyLoad(this); + } catch (IOException e) { + throw new RuntimeException(e.getMessage()); // TODO not sure what to do here!! + } } } @@ -473,6 +476,9 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle setLazyLoaded(false); } + /* + * This method must be called while the state reader for the containing state is locked. + */ void unload() { if ((stateBits & LAZY_LOADED) == 0) return; diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java index eec6e7dc6..21da267d6 100644 --- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java @@ -121,7 +121,6 @@ class StateWriter { // the data is written at least once in the non-lazy state data writeBundleDescription(bundles[i], outState, true); outState.writeBoolean(state.isResolved()); - state.setDynamicCacheChanged(false); } finally { if (outLazy != null) { try { @@ -470,7 +469,6 @@ class StateWriter { public void saveStateDeprecated(StateImpl state, DataOutputStream output) throws IOException { try { writeStateDeprecated(state, output); - state.setDynamicCacheChanged(false); } finally { output.close(); } |