clean code

This commit is contained in:
hengyunabc
2020-06-24 21:50:35 +08:00
parent c83e9f65d2
commit 344cf00d30
2 changed files with 4 additions and 11 deletions
@@ -23,7 +23,6 @@ public class AgentBootstrap {
private static final String ARTHAS_BOOTSTRAP = "com.taobao.arthas.core.server.ArthasBootstrap";
private static final String GET_INSTANCE = "getInstance";
private static final String IS_BIND = "isBind";
private static final String BIND = "bind";
private static PrintStream ps = System.err;
static {
@@ -187,15 +186,9 @@ public class AgentBootstrap {
Object bootstrap = bootstrapClass.getMethod(GET_INSTANCE, Instrumentation.class, String.class).invoke(null, inst, args);
boolean isBind = (Boolean) bootstrapClass.getMethod(IS_BIND).invoke(bootstrap);
if (!isBind) {
try {
ps.println("Arthas start to bind...");
bootstrapClass.getMethod(BIND, String.class).invoke(bootstrap, args);
ps.println("Arthas server bind success.");
return;
} catch (Exception e) {
ps.println("Arthas server port binding failed! Please check $HOME/logs/arthas/arthas.log for more details.");
throw e;
}
String errorMsg = "Arthas server port binding failed! Please check $HOME/logs/arthas/arthas.log for more details.";
ps.println(errorMsg);
throw new RuntimeException(errorMsg);
}
ps.println("Arthas server already bind.");
}
@@ -225,7 +225,7 @@ public class ArthasBootstrap {
* @param configure 配置信息
* @throws IOException 服务器启动失败
*/
public void bind(Configure configure) throws Throwable {
private void bind(Configure configure) throws Throwable {
long start = System.currentTimeMillis();