1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-29 20:05:35 +02:00

[425014] profile commit job don't always complete during shutdown

This commit is contained in:
Dave McKnight 2014-01-07 10:25:49 -05:00
parent e7706ca443
commit 9344fa358a
4 changed files with 37 additions and 10 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. * Copyright (c) 2006, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -22,6 +22,7 @@
* David Dykstal (IBM) - [202630] getDefaultPrivateProfile() and ensureDefaultPrivateProfile() are inconsistent * David Dykstal (IBM) - [202630] getDefaultPrivateProfile() and ensureDefaultPrivateProfile() are inconsistent
* David Dykstal (IBM) - [200735][Persistence] Delete a profile that contains a connection and restart, profile is back without connections * David Dykstal (IBM) - [200735][Persistence] Delete a profile that contains a connection and restart, profile is back without connections
* David Dykstal (IBM) - [226728] NPE during init with clean workspace * David Dykstal (IBM) - [226728] NPE during init with clean workspace
* David McKnight (IBM) -[425014] profile commit job don't always complete during shutdown
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.core.model; package org.eclipse.rse.internal.core.model;
@ -30,6 +31,8 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.eclipse.core.internal.resources.Workspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.RSECorePlugin;
@ -110,11 +113,20 @@ public class SystemProfileManager implements ISystemProfileManager {
} }
public IStatus commitSystemProfile(ISystemProfile profile) { public IStatus commitSystemProfile(ISystemProfile profile) {
return commitSystemProfile(profile, false);
}
public IStatus commitSystemProfile(ISystemProfile profile, boolean immediate) {
IStatus status = Status.OK_STATUS; IStatus status = Status.OK_STATUS;
boolean scheduled = false; boolean scheduled = false;
if (active) { if (active) {
if (!RSECorePlugin.getThePersistenceManager().isBusy()) { if (!RSECorePlugin.getThePersistenceManager().isBusy()) {
scheduled = RSECorePlugin.getThePersistenceManager().commitProfile(profile, 5000); if (immediate){
scheduled = RSECorePlugin.getThePersistenceManager().commitProfile(profile, 0);
}
else {
scheduled = RSECorePlugin.getThePersistenceManager().commitProfile(profile, 5000);
}
} }
} else { } else {
scheduled = true; scheduled = true;

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2006, 2009 IBM Corporation and others. All rights reserved. * Copyright (c) 2006, 2014 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -24,6 +24,7 @@
* Kevin Doyle (IBM) - [243821] Save occurring on Main Thread * Kevin Doyle (IBM) - [243821] Save occurring on Main Thread
* David Dykstal (IBM) - [243128] Problem during migration - NPE if provider does save without using a job. * David Dykstal (IBM) - [243128] Problem during migration - NPE if provider does save without using a job.
* Martin Oberhuber (Wind River) - [261503][cleanup] Get rid of deprecated getPluginPreferences() * Martin Oberhuber (Wind River) - [261503][cleanup] Get rid of deprecated getPluginPreferences()
* David McKnight (IBM) -[425014] profile commit job don't always complete during shutdown
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.persistence; package org.eclipse.rse.internal.persistence;
@ -556,8 +557,9 @@ public class RSEPersistenceManager implements IRSEPersistenceManager {
cleanTree(profile); cleanTree(profile);
if (dom.needsSave()) { if (dom.needsSave()) {
Job job = provider.getSaveJob(dom); Job job = provider.getSaveJob(dom);
if (job != null && canScheduleSave) { if (job != null && canScheduleSave
job.addJobChangeListener(jobChangeListener); && timeout > 0) { // timeout of zero indicates shutdown - no time for job scheduling
job.addJobChangeListener(jobChangeListener);
job.schedule(2000); // two second delay job.schedule(2000); // two second delay
} else { } else {
provider.saveRSEDOM(dom, new NullProgressMonitor()); provider.saveRSEDOM(dom, new NullProgressMonitor());

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2002, 2011 IBM Corporation and others. * Copyright (c) 2002, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -14,6 +14,7 @@
* Contributors: * Contributors:
* David McKnight (IBM) - [165680] "Show in Remote Shell View" does not work * David McKnight (IBM) - [165680] "Show in Remote Shell View" does not work
* David McKnight (IBM) - [338031] Remote Shell view tabs should have close (x) icon * David McKnight (IBM) - [338031] Remote Shell view tabs should have close (x) icon
* David McKnight (IBM) -[425014] profile commit job don't always complete during shutdown
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.shells.ui.view; package org.eclipse.rse.internal.shells.ui.view;
@ -245,7 +246,9 @@ public class CommandsViewWorkbook extends Composite
try { try {
IRemoteCmdSubSystem cmdSubSystem = command.getCommandSubSystem(); IRemoteCmdSubSystem cmdSubSystem = command.getCommandSubSystem();
if (cmdSubSystem != null && cmdSubSystem.isConnected()){ if (cmdSubSystem != null && cmdSubSystem.isConnected()){
cmdSubSystem.removeShell(command); if (!_viewPart.getSite().getWorkbenchWindow().getWorkbench().isClosing()){
cmdSubSystem.removeShell(command);
}
} }
} }
catch (Exception ex){ catch (Exception ex){

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2002, 2011 IBM Corporation and others. All rights reserved. * Copyright (c) 2002, 2014 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -50,6 +50,7 @@
* David McKnight (IBM) - [284018] concurrent SubSystem.connect() calls can result in double login-prompt * David McKnight (IBM) - [284018] concurrent SubSystem.connect() calls can result in double login-prompt
* David McKnight (IBM) - [318836] Period in filter name causes wrong message on drag and drop * David McKnight (IBM) - [318836] Period in filter name causes wrong message on drag and drop
* David McKnight (IBM) - [326555] Dead lock when debug session starts * David McKnight (IBM) - [326555] Dead lock when debug session starts
* David McKnight (IBM) -[425014] profile commit job don't always complete during shutdown
* ********************************************************************************/ * ********************************************************************************/
package org.eclipse.rse.core.subsystems; package org.eclipse.rse.core.subsystems;
@ -117,6 +118,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PropertyPage; import org.eclipse.ui.dialogs.PropertyPage;
import org.eclipse.ui.progress.UIJob; import org.eclipse.ui.progress.UIJob;
import org.eclipse.ui.progress.WorkbenchJob; import org.eclipse.ui.progress.WorkbenchJob;
@ -3296,8 +3298,16 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
public boolean commit() public boolean commit()
{ {
ISystemProfile profile = getSystemProfile(); ISystemProfile profile = getSystemProfile();
boolean result = profile.commit(); if (PlatformUI.getWorkbench().isClosing()){
return result; // commit job may fail due to shutdown
// force this by directly calling with true
IStatus status = SystemProfileManager.getDefault().commitSystemProfile(profile, true);
return status.isOK();
}
else {
boolean result = profile.commit();
return result;
}
} }
public IRSEPersistableContainer getPersistableParent() { public IRSEPersistableContainer getPersistableParent() {