mirror of
https://github.com/alibaba/arthas.git
synced 2024-04-21 10:21:39 +00:00
add stop command, an alias for shutdown. #707
This commit is contained in:
@@ -9,6 +9,7 @@ import com.taobao.arthas.core.command.basic1000.PwdCommand;
|
||||
import com.taobao.arthas.core.command.basic1000.ResetCommand;
|
||||
import com.taobao.arthas.core.command.basic1000.SessionCommand;
|
||||
import com.taobao.arthas.core.command.basic1000.ShutdownCommand;
|
||||
import com.taobao.arthas.core.command.basic1000.StopCommand;
|
||||
import com.taobao.arthas.core.command.basic1000.SystemEnvCommand;
|
||||
import com.taobao.arthas.core.command.basic1000.SystemPropertyCommand;
|
||||
import com.taobao.arthas.core.command.basic1000.VersionCommand;
|
||||
@@ -84,6 +85,7 @@ public class BuiltinCommandPack implements CommandResolver {
|
||||
commands.add(Command.create(ResetCommand.class));
|
||||
commands.add(Command.create(VersionCommand.class));
|
||||
commands.add(Command.create(ShutdownCommand.class));
|
||||
commands.add(Command.create(StopCommand.class));
|
||||
commands.add(Command.create(SessionCommand.class));
|
||||
commands.add(Command.create(SystemPropertyCommand.class));
|
||||
commands.add(Command.create(SystemEnvCommand.class));
|
||||
|
||||
@@ -16,12 +16,17 @@ import java.lang.instrument.UnmodifiableClassException;
|
||||
* 关闭命令
|
||||
*
|
||||
* @author vlinux on 14/10/23.
|
||||
* @see StopCommand
|
||||
*/
|
||||
@Name("shutdown")
|
||||
@Summary("Shutdown Arthas server and exit the console")
|
||||
public class ShutdownCommand extends AnnotatedCommand {
|
||||
@Override
|
||||
public void process(CommandProcess process) {
|
||||
shutdown(process);
|
||||
}
|
||||
|
||||
public static void shutdown(CommandProcess process) {
|
||||
try {
|
||||
// 退出之前需要重置所有的增强类
|
||||
Instrumentation inst = process.session().getInstrumentation();
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.taobao.arthas.core.command.basic1000;
|
||||
|
||||
import com.taobao.arthas.core.shell.command.AnnotatedCommand;
|
||||
import com.taobao.arthas.core.shell.command.CommandProcess;
|
||||
import com.taobao.middleware.cli.annotations.Name;
|
||||
import com.taobao.middleware.cli.annotations.Summary;
|
||||
|
||||
/**
|
||||
* Alias for ShutdownCommand
|
||||
* @author hengyunabc 2019-07-05
|
||||
* @see ShutdownCommand
|
||||
*/
|
||||
@Name("stop")
|
||||
@Summary("Stop/Shutdown Arthas server and exit the console. Alias for shutdown.")
|
||||
public class StopCommand extends AnnotatedCommand {
|
||||
@Override
|
||||
public void process(CommandProcess process) {
|
||||
ShutdownCommand.shutdown(process);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user