Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java26
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)

Back to the top