From 771c253b0fc7edab09a4c47828e831a4f1a5d159 Mon Sep 17 00:00:00 2001 From: "Keith W. Campbell" Date: Thu, 10 May 2018 10:21:11 -0400 Subject: [PATCH] Remove DDR interactive 'limit' command It relied on API [Thread.stop(Throwable)] that has long since been deprecated (and marked for removal starting with Java 9); there's no practical replacement implementation strategy. Signed-off-by: Keith W. Campbell --- .../tools/ddrinteractive/DDRInteractive.java | 5 +- .../ddrinteractive/commands/LimitCommand.java | 80 ------------------- 2 files changed, 1 insertion(+), 84 deletions(-) delete mode 100644 debugtools/DDR_VM/src/com/ibm/j9ddr/tools/ddrinteractive/commands/LimitCommand.java diff --git a/debugtools/DDR_VM/src/com/ibm/j9ddr/tools/ddrinteractive/DDRInteractive.java b/debugtools/DDR_VM/src/com/ibm/j9ddr/tools/ddrinteractive/DDRInteractive.java index cfe7e18cc14..5fed57d77ec 100644 --- a/debugtools/DDR_VM/src/com/ibm/j9ddr/tools/ddrinteractive/DDRInteractive.java +++ b/debugtools/DDR_VM/src/com/ibm/j9ddr/tools/ddrinteractive/DDRInteractive.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2015 IBM Corp. and others + * Copyright (c) 1991, 2018 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -55,7 +55,6 @@ import com.ibm.j9ddr.exceptions.MissingDDRStructuresException; import com.ibm.j9ddr.logging.LoggerNames; import com.ibm.j9ddr.tools.ddrinteractive.commands.ForeachCommand; -import com.ibm.j9ddr.tools.ddrinteractive.commands.LimitCommand; import com.ibm.j9ddr.tools.ddrinteractive.commands.LookupSymbolCommand; import com.ibm.j9ddr.tools.ddrinteractive.commands.NativeLibrariesCommand; import com.ibm.j9ddr.tools.ddrinteractive.commands.NativeStacksCommand; @@ -65,7 +64,6 @@ import com.ibm.j9ddr.view.dtfj.image.J9DDRImageAddressSpace; import com.ibm.j9ddr.view.dtfj.image.J9DDRImageProcess; - public class DDRInteractive implements Runnable { private final PrintStream out; @@ -95,7 +93,6 @@ public class DDRInteractive implements Runnable localCommandList.add(new NativeStacksCommand()); localCommandList.add(new ExtractMemoryCommand()); localCommandList.add(new TimeCommand()); - localCommandList.add(new LimitCommand()); localCommandList.add(new ForeachCommand()); nonVMCommands = Collections.unmodifiableList(localCommandList); diff --git a/debugtools/DDR_VM/src/com/ibm/j9ddr/tools/ddrinteractive/commands/LimitCommand.java b/debugtools/DDR_VM/src/com/ibm/j9ddr/tools/ddrinteractive/commands/LimitCommand.java deleted file mode 100644 index f91a8abde45..00000000000 --- a/debugtools/DDR_VM/src/com/ibm/j9ddr/tools/ddrinteractive/commands/LimitCommand.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014, 2015 IBM Corp. and others - * - * This program and the accompanying materials are made available under - * the terms of the Eclipse Public License 2.0 which accompanies this - * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ - * or the Apache License, Version 2.0 which accompanies this distribution and - * is available at https://www.apache.org/licenses/LICENSE-2.0. - * - * This Source Code may also be made available under the following - * Secondary Licenses when the conditions for such availability set - * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU - * General Public License, version 2 with the GNU Classpath - * Exception [1] and GNU General Public License, version 2 with the - * OpenJDK Assembly Exception [2]. - * - * [1] https://www.gnu.org/software/classpath/license.html - * [2] http://openjdk.java.net/legal/assembly-exception.html - * - * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception - *******************************************************************************/ -package com.ibm.j9ddr.tools.ddrinteractive.commands; - -import java.io.PrintStream; -import java.text.ParseException; - -import com.ibm.j9ddr.command.CommandParser; -import com.ibm.j9ddr.tools.ddrinteractive.Command; -import com.ibm.j9ddr.tools.ddrinteractive.Context; -import com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException; - -public class LimitCommand extends Command { - - public LimitCommand() - { - addCommand("limit", " []", "run another command; terminate if it exceeds the timeout"); - } - - @SuppressWarnings("deprecation") - public void run(String command, final String[] args, final Context context, final PrintStream out) throws DDRInteractiveCommandException { - final String[] newArgs; - if (args.length < 2) { - out.println("The limit command requires a timeout and another command to run as an argument."); - return; - } - - long timeout = Integer.parseInt(args[0]) * 1000; - - if (args.length > 2) { - newArgs = new String[args.length - 2]; - System.arraycopy(args, 2, newArgs, 0, newArgs.length); - } else { - newArgs = new String[0]; - } - - Thread runner = new Thread("LimitCommand: " + args[1]) - { - public void run() - { - try { - CommandParser commandParser = new CommandParser(args[1], newArgs); - context.execute(commandParser, out); - } catch (ParseException e) { - e.printStackTrace(out); - } - } - }; - runner.start(); - try { - runner.join(timeout); - } catch (InterruptedException e) { - e.printStackTrace(); - } - if (runner.isAlive()) { - runner.stop(new DDRInteractiveCommandException("Timeout exceeded!")); - } - - } - -}