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:
parent
e7706ca443
commit
9344fa358a
4 changed files with 37 additions and 10 deletions
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -22,6 +22,7 @@
|
|||
* 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) - [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;
|
||||
|
@ -30,6 +31,8 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
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.Status;
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
|
@ -110,11 +113,20 @@ public class SystemProfileManager implements ISystemProfileManager {
|
|||
}
|
||||
|
||||
public IStatus commitSystemProfile(ISystemProfile profile) {
|
||||
return commitSystemProfile(profile, false);
|
||||
}
|
||||
|
||||
public IStatus commitSystemProfile(ISystemProfile profile, boolean immediate) {
|
||||
IStatus status = Status.OK_STATUS;
|
||||
boolean scheduled = false;
|
||||
if (active) {
|
||||
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 {
|
||||
scheduled = true;
|
||||
|
|
|
@ -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
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
|
@ -24,6 +24,7 @@
|
|||
* 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.
|
||||
* 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;
|
||||
|
@ -556,8 +557,9 @@ public class RSEPersistenceManager implements IRSEPersistenceManager {
|
|||
cleanTree(profile);
|
||||
if (dom.needsSave()) {
|
||||
Job job = provider.getSaveJob(dom);
|
||||
if (job != null && canScheduleSave) {
|
||||
job.addJobChangeListener(jobChangeListener);
|
||||
if (job != null && canScheduleSave
|
||||
&& timeout > 0) { // timeout of zero indicates shutdown - no time for job scheduling
|
||||
job.addJobChangeListener(jobChangeListener);
|
||||
job.schedule(2000); // two second delay
|
||||
} else {
|
||||
provider.saveRSEDOM(dom, new NullProgressMonitor());
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -14,6 +14,7 @@
|
|||
* Contributors:
|
||||
* 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) -[425014] profile commit job don't always complete during shutdown
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.shells.ui.view;
|
||||
|
@ -245,7 +246,9 @@ public class CommandsViewWorkbook extends Composite
|
|||
try {
|
||||
IRemoteCmdSubSystem cmdSubSystem = command.getCommandSubSystem();
|
||||
if (cmdSubSystem != null && cmdSubSystem.isConnected()){
|
||||
cmdSubSystem.removeShell(command);
|
||||
if (!_viewPart.getSite().getWorkbenchWindow().getWorkbench().isClosing()){
|
||||
cmdSubSystem.removeShell(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex){
|
||||
|
|
|
@ -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
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* 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) - [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) -[425014] profile commit job don't always complete during shutdown
|
||||
* ********************************************************************************/
|
||||
|
||||
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.Shell;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.dialogs.PropertyPage;
|
||||
import org.eclipse.ui.progress.UIJob;
|
||||
import org.eclipse.ui.progress.WorkbenchJob;
|
||||
|
@ -3296,8 +3298,16 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
|
|||
public boolean commit()
|
||||
{
|
||||
ISystemProfile profile = getSystemProfile();
|
||||
boolean result = profile.commit();
|
||||
return result;
|
||||
if (PlatformUI.getWorkbench().isClosing()){
|
||||
// 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() {
|
||||
|
|
Loading…
Add table
Reference in a new issue