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

[dstore] cancelable threads not removed fast enough from Hashmap, resulting in OOM

This commit is contained in:
David McKnight 2012-01-27 15:44:05 +00:00
parent 9ebcb4d8e0
commit 45a28e5d36
2 changed files with 31 additions and 5 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2002, 2009 IBM Corporation and others. * Copyright (c) 2002, 2012 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
@ -41,6 +41,7 @@
* David McKnight (IBM) - [251729][dstore] problems querying symbolic link folder * David McKnight (IBM) - [251729][dstore] problems querying symbolic link folder
* David McKnight (IBM) - [243495] [api] New: Allow file name search in Remote Search to not be case sensitive * David McKnight (IBM) - [243495] [api] New: Allow file name search in Remote Search to not be case sensitive
* David McKnight (IBM) - [283617] [dstore] UniversalFileSystemMiner.handleQueryGetRemoteObject does not return correct result when the queried file does not exist. * David McKnight (IBM) - [283617] [dstore] UniversalFileSystemMiner.handleQueryGetRemoteObject does not return correct result when the queried file does not exist.
* David McKnight (IBM) - [dstore] cancelable threads not removed fast enough from Hashmap, resulting in OOM
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.dstore.universal.miners; package org.eclipse.rse.dstore.universal.miners;
@ -470,8 +471,10 @@ public class UniversalFileSystemMiner extends Miner {
_dataStore.trace(e); _dataStore.trace(e);
} }
// save find thread in hashmap for retrieval during cancel // save find thread in hashmap for retrieval during cancel
if (!thread.isDone() && !thread.isCancelled()){
_cancellableThreads.put(command, thread); _cancellableThreads.put(command, thread);
} }
}
/** /**
@ -1352,7 +1355,7 @@ public class UniversalFileSystemMiner extends Miner {
} }
public void finish() { public void finish() {
//_archiveHandlerManager.dispose(); _cancellableThreads.clear();
super.finish(); super.finish();
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. * Copyright (c) 2006, 2012 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:
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
* David McKnight (IBM) - [dstore] cancelable threads not removed fast enough from Hashmap, resulting in OOM
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem; package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@ -24,6 +25,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import org.eclipse.dstore.core.model.DE; import org.eclipse.dstore.core.model.DE;
import org.eclipse.dstore.core.model.DataElement; import org.eclipse.dstore.core.model.DataElement;
@ -64,6 +66,27 @@ public class UniversalDownloadHandler extends SecuredThread implements ICancella
handleDownload(_cmdElement, _status); handleDownload(_cmdElement, _status);
_isDone = true; _isDone = true;
removeFromCancellableList();
}
private void removeFromCancellableList(){
Class clazz = _miner.getClass();
try {
Method[] methods = clazz.getDeclaredMethods();
for (int i = 0; i < methods.length; i++){
Method method = methods[i];
if (method.getName().equals("updateCancellableThreads")){ //$NON-NLS-1$
method.setAccessible(true);
Object[] args = { _status.getParent(), this };
method.invoke(_miner, args);
return;
}
}
} catch (Exception e) {
_dataStore.trace(e);
}
} }
public boolean isDone() public boolean isDone()