diff options
author | John Arthorne | 2010-03-08 16:08:45 +0000 |
---|---|---|
committer | John Arthorne | 2010-03-08 16:08:45 +0000 |
commit | d9cdee703e22ad33228f67793ba8a5c3c8a77f50 (patch) | |
tree | 02b7472652f57da20ce4ea2ec5b00d771521fcc0 /bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine | |
parent | 2287f54f05a771dc4cda725d63d82d11bf9d44c3 (diff) | |
download | rt.equinox.p2-d9cdee703e22ad33228f67793ba8a5c3c8a77f50.tar.gz rt.equinox.p2-d9cdee703e22ad33228f67793ba8a5c3c8a77f50.tar.xz rt.equinox.p2-d9cdee703e22ad33228f67793ba8a5c3c8a77f50.zip |
Bug 304899 - ProfilePreferences remembers obsolete provisioning agent in the saveJob
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java index 1f03c04bb..195c8c576 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java @@ -32,7 +32,7 @@ import org.osgi.service.prefs.BackingStoreException; */ public class ProfilePreferences extends EclipsePreferences { private class SaveJob extends Job { - private IProvisioningAgent agent; + IProvisioningAgent agent; SaveJob(IProvisioningAgent agent) { super(Messages.ProfilePreferences_saving); @@ -268,23 +268,21 @@ public class ProfilePreferences extends EclipsePreferences { * of the save job instance. */ protected synchronized void save() throws BackingStoreException { - if (saveJob == null) { - ServiceReference agentRef; - try { - agentRef = getAgent(getSegment(absolutePath(), 1)); - IProvisioningAgent agent = (IProvisioningAgent) EngineActivator.getContext().getService(agentRef); + try { + ServiceReference agentRef = getAgent(getSegment(absolutePath(), 1)); + IProvisioningAgent agent = (IProvisioningAgent) EngineActivator.getContext().getService(agentRef); + if (saveJob == null || saveJob.agent != agent) saveJob = new SaveJob(agent); - EngineActivator.getContext().ungetService(agentRef); - } catch (BackingStoreException e) { - if (Tracing.DEBUG_PROFILE_PREFERENCES) - e.printStackTrace(); - //get agent has already gone away so we can't save preferences - //TODO see bug 300450 - } + EngineActivator.getContext().ungetService(agentRef); + } catch (BackingStoreException e) { + if (Tracing.DEBUG_PROFILE_PREFERENCES) + e.printStackTrace(); + //get agent has already gone away so we can't save preferences + //TODO see bug 300450 } //only schedule a save if the engine bundle is still running BundleContext context = EngineActivator.getContext(); - if (context == null) + if (context == null || saveJob == null) return; try { if (context.getBundle().getState() == Bundle.ACTIVE) |