diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/CommandMiner.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/CommandMiner.java index 48451cfdb86..92a236ca1dc 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/CommandMiner.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/CommandMiner.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2011 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 @@ -23,6 +23,7 @@ * David McKnight (IBM) [320624] [dstore] shell < and > sequence conversion not being applied to thread * David McKnight (IBM) - [283613] [dstore] Create a Constants File for all System Properties we support * Noriaki Takatsu (IBM) - [365765] [dstore][multithread]client environment cause harm to singe-process server + * David McKnight (IBM) - [396783] [dstore] fix issues with the spiriting mechanism and other memory improvements (phase 2) *******************************************************************************/ package org.eclipse.rse.dstore.universal.miners; @@ -32,6 +33,7 @@ package org.eclipse.rse.dstore.universal.miners; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import org.eclipse.dstore.core.miners.Miner; @@ -264,13 +266,19 @@ public class CommandMiner extends Miner Iterator iter = _threads.keySet().iterator(); try { + List threadsToRemove = new ArrayList(); while (iter.hasNext()) { String threadName = (String) iter.next(); CommandMinerThread theThread = (CommandMinerThread) _threads.get(threadName); if ((theThread == null) || (!theThread.isAlive())) { - _threads.remove(threadName); + threadsToRemove.add(threadName); + } + } + if (!threadsToRemove.isEmpty()){ + for (int i = 0; i < threadsToRemove.size(); i++){ + _threads.remove(threadsToRemove.get(i)); } } } @@ -278,6 +286,8 @@ public class CommandMiner extends Miner { _dataStore.trace(e); } + + CommandMinerThread newCommand = new CommandMinerThread(subject, invocation, status, getPatterns(), _descriptors); _threads.put(status.getAttribute(DE.A_ID), newCommand); newCommand.start(); diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalDownloadHandler.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalDownloadHandler.java index 6137b814a6c..da9480de94b 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalDownloadHandler.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalDownloadHandler.java @@ -15,6 +15,7 @@ * 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 + * David McKnight (IBM) - [396783] [dstore] fix issues with the spiriting mechanism and other memory improvements (phase 2) *******************************************************************************/ package org.eclipse.rse.internal.dstore.universal.miners.filesystem; @@ -64,9 +65,10 @@ public class UniversalDownloadHandler extends SecuredThread implements ICancella { super.run(); - handleDownload(_cmdElement, _status); + handleDownload(_cmdElement, _status); _isDone = true; removeFromCancellableList(); + _dataStore.disconnectObject(_cmdElement); } private void removeFromCancellableList(){ diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalSearchHandler.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalSearchHandler.java index f817f17c044..0d4458abd39 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalSearchHandler.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/UniversalSearchHandler.java @@ -30,6 +30,7 @@ * Noriaki Takatsu (IBM) - [362025] [dstore] Search for text hung in encountering a device definition * David McKnight (IBM) - [371401] [dstore][multithread] avoid use of static variables - causes memory leak after disconnect * Noriaki Takatsu (IBM) - [380562] [multithread][dstore] File Search is not canceled by the client UI on disconnect + * David McKnight (IBM) - [396783] [dstore] fix issues with the spiriting mechanism and other memory improvements (phase 2) ********************************************************************************/ package org.eclipse.rse.internal.dstore.universal.miners.filesystem; @@ -166,6 +167,7 @@ public class UniversalSearchHandler extends SecuredThread implements ICancellabl // completed before setting the status to done _status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$ _dataStore.refresh(_status); // true indicates refresh immediately + _miner.updateCancellableThreads(_status.getParent(), this); } _alreadySearched.clear(); @@ -377,6 +379,7 @@ public class UniversalSearchHandler extends SecuredThread implements ICancellabl checkAndClearupMemory(); File child = children[i]; internalSearch(child, depth - 1); + } } } diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java index 2670d7f7c64..ea52759364a 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java @@ -67,6 +67,7 @@ * David McKnight (IBM) - [365780] [dstore] codepage conversion should only occur for different encodings * David McKnight (IBM) - [390037] [dstore] Duplicated items in the System view * David McKnight (IBM) - [391164] [dstore] don't clear cached elements when they're not spirited or deleted + * David McKnight (IBM) - [396783] [dstore] fix issues with the spiriting mechanism and other memory improvements (phase 2) *******************************************************************************/ package org.eclipse.rse.internal.services.dstore.files; @@ -304,7 +305,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer if (ds != null) { String[] clonedAttributes = (String[])_filterAttributes.clone(); - clonedAttributes[DE.A_ID] = fileNameFilter; + //clonedAttributes[DE.A_ID] = fileNameFilter; DataElement attributes = ds.createTransientObject(clonedAttributes); String version = IServiceConstants.VERSION_1;