From ed172f6eb3b797335f0b18b9679ac2a7de2f3e76 Mon Sep 17 00:00:00 2001 From: David McKnight Date: Mon, 10 Jan 2011 14:48:44 +0000 Subject: [PATCH] [282364] [dstore][multithread] timer-threads stay active after disconnect --- .../src/org/eclipse/dstore/core/util/Receiver.java | 6 +++++- .../internal/core/server/ServerCommandHandler.java | 8 +++++++- .../dstore/internal/core/util/XMLparser.java | 13 ++++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/Receiver.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/Receiver.java index f276b832154..21e1f95b565 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/Receiver.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/util/Receiver.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2010 IBM Corporation and others. + * Copyright (c) 2002, 2011 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 @@ -18,6 +18,7 @@ * David McKnight (IBM) - [225507][api][breaking] RSE dstore API leaks non-API types * David McKnight (IBM) - [226561] [apidoc] Add API markup to RSE Javadocs where extend / implement is allowed * Noriaki Takatsu (IBM) - [289234][multithread][api] Reset and Restart KeepAliveRequestThread + * David McKnight (IBM) - [282364] [dstore][multithread] timer-threads stay active after disconnect *******************************************************************************/ package org.eclipse.dstore.core.util; @@ -98,6 +99,9 @@ public abstract class Receiver extends SecuredThread implements IDataStorePrefer public void finish() { _canExit = true; + + // one final call here to cleanup parser + handleInput(); } /** diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/server/ServerCommandHandler.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/server/ServerCommandHandler.java index 34b100ab7e8..f0668025506 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/server/ServerCommandHandler.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/server/ServerCommandHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2009 IBM Corporation and others. + * Copyright (c) 2002, 2011 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 @@ -17,6 +17,7 @@ * David McKnight (IBM) - [278341] [dstore] Disconnect on idle causes the client hang * Noriaki Takatsu (IBM) - [283656] [dstore][multithread] Serviceability issue * David McKnight (IBM) - [294933] [dstore] RSE goes into loop + * David McKnight (IBM) - [282364] [dstore][multithread] timer-threads stay active after disconnect *******************************************************************************/ package org.eclipse.dstore.internal.core.server; @@ -200,6 +201,11 @@ public class ServerCommandHandler extends CommandHandler */ public void finish() { + if (_serverIdleThread != null && _serverIdleThread.isAlive()){ + _serverIdleThread._serverTimedOut=true; // ensures that the wait loop won't continue after the interrupt + _serverIdleThread.interrupt(); + } + if (_minerLoader != null) _minerLoader.finishMiners(); super.finish(); diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/util/XMLparser.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/util/XMLparser.java index dd24467000f..a85c0fb8b6d 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/util/XMLparser.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/util/XMLparser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2010 IBM Corporation and others. + * Copyright (c) 2002, 2011 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 @@ -21,6 +21,7 @@ * David McKnight (IBM) [307541][dstore] fix for Bug 305218 breaks RDz connections * David McKnight (IBM) [322407][dstore] Connection dropped automatically when idle * Noriaki Takatsu (IBM) - [289234][multithread][api] Reset and Restart KeepAliveRequestThread + * David McKnight (IBM) - [282364] [dstore][multithread] timer-threads stay active after disconnect *******************************************************************************/ package org.eclipse.dstore.internal.core.util; @@ -516,6 +517,16 @@ public class XMLparser */ public DataElement parseDocument(BufferedInputStream reader, Socket socket) throws IOException { + if (!_dataStore.isConnected()){ + if (_kart != null && _kart.isAlive()){ + _kart.interrupt(); + } + if (_initialKart != null && _initialKart.isAlive()){ + _initialKart.interrupt(); + } + return null; + } + _tagStack.clear(); _objStack.clear();