1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-02 22:55:26 +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
* are made available under the terms of the Eclipse Public License v1.0
* 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) - [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) - [dstore] cancelable threads not removed fast enough from Hashmap, resulting in OOM
*******************************************************************************/
package org.eclipse.rse.dstore.universal.miners;
@ -470,7 +471,9 @@ public class UniversalFileSystemMiner extends Miner {
_dataStore.trace(e);
}
// save find thread in hashmap for retrieval during cancel
_cancellableThreads.put(command, thread);
if (!thread.isDone() && !thread.isCancelled()){
_cancellableThreads.put(command, thread);
}
}
@ -1352,7 +1355,7 @@ public class UniversalFileSystemMiner extends Miner {
}
public void finish() {
//_archiveHandlerManager.dispose();
_cancellableThreads.clear();
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
* 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:
* 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
* David McKnight (IBM) - [dstore] cancelable threads not removed fast enough from Hashmap, resulting in OOM
*******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@ -24,6 +25,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import org.eclipse.dstore.core.model.DE;
import org.eclipse.dstore.core.model.DataElement;
@ -62,8 +64,29 @@ public class UniversalDownloadHandler extends SecuredThread implements ICancella
{
super.run();
handleDownload(_cmdElement, _status);
handleDownload(_cmdElement, _status);
_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()