code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
@Override public int getLock() { return lock.get(); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
getLock
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
Apache-2.0
@Override public String getSessionId() { return (String) data.get(ID); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
getSessionId
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
Apache-2.0
@Override public long getPid() { return (Long) data.get(PID); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
getPid
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
Apache-2.0
@Override public List<CommandResolver> getCommandResolvers() { InternalCommandManager commandManager = (InternalCommandManager) data.get(COMMAND_MANAGER); return commandManager.getResolvers(); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
getCommandResolvers
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
Apache-2.0
@Override public Instrumentation getInstrumentation() { return (Instrumentation) data.get(INSTRUMENTATION); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
getInstrumentation
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
Apache-2.0
@Override public void setLastAccessTime(long time) { data.put(LAST_ACCESS_TIME, time); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
setLastAccessTime
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
Apache-2.0
@Override public long getLastAccessTime() { return (Long)data.get(LAST_ACCESS_TIME); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
getLastAccessTime
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
Apache-2.0
@Override public long getCreateTime() { return (Long)data.get(CREATE_TIME); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
getCreateTime
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
Apache-2.0
@Override public void setResultDistributor(SharingResultDistributor resultDistributor) { data.put(RESULT_DISTRIBUTOR, resultDistributor); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
setResultDistributor
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
Apache-2.0
@Override public SharingResultDistributor getResultDistributor() { return (SharingResultDistributor) data.get(RESULT_DISTRIBUTOR); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
getResultDistributor
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
Apache-2.0
@Override public void setForegroundJob(Job job) { data.put(FOREGROUND_JOB, job); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
setForegroundJob
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
Apache-2.0
@Override public Job getForegroundJob() { return (Job) data.get(FOREGROUND_JOB); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
getForegroundJob
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
Apache-2.0
@Override public boolean isTty() { return get(TTY) != null; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
isTty
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/session/impl/SessionImpl.java
Apache-2.0
public List<CommandResolver> getResolvers() { return resolvers; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
getResolvers
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/InternalCommandManager.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/InternalCommandManager.java
Apache-2.0
public void complete(final Completion completion) { List<CliToken> lineTokens = completion.lineTokens(); int index = findLastPipe(lineTokens); LinkedList<CliToken> tokens = new LinkedList<CliToken>(lineTokens.subList(index + 1, lineTokens.size())); // Remove any leading white space while (tokens.size() > 0 && tokens.getFirst().isBlank()) { tokens.removeFirst(); } // > 1 means it's a text token followed by something else if (tokens.size() > 1) { completeSingleCommand(completion, tokens); } else { completeCommands(completion, tokens); } }
Perform completion, the completion argument will be notified of the completion progress. @param completion the completion object
complete
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/InternalCommandManager.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/InternalCommandManager.java
Apache-2.0
private void completeCommands(Completion completion, LinkedList<CliToken> tokens) { String prefix = tokens.size() > 0 ? tokens.getFirst().value() : ""; List<String> names = new LinkedList<String>(); for (CommandResolver resolver : resolvers) { for (Command command : resolver.commands()) { String name = command.name(); boolean hidden = command.cli() != null && command.cli().isHidden(); if (name.startsWith(prefix) && !names.contains(name) && !hidden) { names.add(name); } } } if (names.size() == 1) { completion.complete(names.get(0).substring(prefix.length()), true); } else { String commonPrefix = CompletionUtils.findLongestCommonPrefix(names); if (commonPrefix.length() > prefix.length()) { completion.complete(commonPrefix.substring(prefix.length()), false); } else { completion.complete(names); } } }
Perform completion, the completion argument will be notified of the completion progress. @param completion the completion object
completeCommands
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/InternalCommandManager.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/InternalCommandManager.java
Apache-2.0
private void completeSingleCommand(Completion completion, LinkedList<CliToken> tokens) { ListIterator<CliToken> it = tokens.listIterator(); while (it.hasNext()) { CliToken ct = it.next(); it.remove(); if (ct.isText()) { final List<CliToken> newTokens = new ArrayList<CliToken>(); while (it.hasNext()) { newTokens.add(it.next()); } StringBuilder tmp = new StringBuilder(); for (CliToken token : newTokens) { tmp.append(token.raw()); } final String line = tmp.toString(); for (CommandResolver resolver : resolvers) { Command command = getCommand(resolver, ct.value()); if (command != null) { command.complete(new CommandCompletion(completion, line, newTokens)); return; } } completion.complete(Collections.<String>emptyList()); } } }
Perform completion, the completion argument will be notified of the completion progress. @param completion the completion object
completeSingleCommand
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/InternalCommandManager.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/InternalCommandManager.java
Apache-2.0
private static Command getCommand(CommandResolver commandResolver, String name) { List<Command> commands = commandResolver.commands(); if (commands == null || commands.isEmpty()) { return null; } for (Command command : commands) { if (name.equals(command.name())) { return command; } } return null; }
Perform completion, the completion argument will be notified of the completion progress. @param completion the completion object
getCommand
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/InternalCommandManager.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/InternalCommandManager.java
Apache-2.0
private static int findLastPipe(List<CliToken> lineTokens) { int index = -1; for (int i = 0; i < lineTokens.size(); i++) { if ("|".equals(lineTokens.get(i).value())) { index = i; } } return index; }
Perform completion, the completion argument will be notified of the completion progress. @param completion the completion object
findLastPipe
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/InternalCommandManager.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/InternalCommandManager.java
Apache-2.0
public synchronized Set<Job> jobs() { return new HashSet<Job>(jobs.values()); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
jobs
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
Apache-2.0
public synchronized Job getJob(int id) { return jobs.get(id); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
getJob
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
Apache-2.0
synchronized boolean removeJob(int id) { return jobs.remove(id) != null; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
removeJob
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
Apache-2.0
@Override public Job createJob(InternalCommandManager commandManager, List<CliToken> tokens, Session session, JobListener jobHandler, Term term, ResultDistributor resultDistributor) { checkPermission(session, tokens.get(0)); int jobId = idGenerator.incrementAndGet(); StringBuilder line = new StringBuilder(); for (CliToken arg : tokens) { line.append(arg.raw()); } boolean runInBackground = runInBackground(tokens); Process process = createProcess(session, tokens, commandManager, jobId, term, resultDistributor); process.setJobId(jobId); JobImpl job = new JobImpl(jobId, this, process, line.toString(), runInBackground, session, jobHandler); jobs.put(jobId, job); return job; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
createJob
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
Apache-2.0
private int getRedirectJobCount() { int count = 0; for (Job job : jobs.values()) { if (job.process() != null && job.process().cacheLocation() != null) { count++; } } return count; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
getRedirectJobCount
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
Apache-2.0
@Override public void close(final Handler<Void> completionHandler) { List<JobImpl> jobs; synchronized (this) { if (closed) { jobs = Collections.emptyList(); } else { jobs = new ArrayList<JobImpl>(this.jobs.values()); closed = true; } } if (jobs.isEmpty()) { if (completionHandler!= null) { completionHandler.handle(null); } } else { final AtomicInteger count = new AtomicInteger(jobs.size()); for (JobImpl job : jobs) { job.terminateFuture.setHandler(new Handler<Future<Void>>() { @Override public void handle(Future<Void> v) { if (count.decrementAndGet() == 0 && completionHandler != null) { completionHandler.handle(null); } } }); job.terminate(); } } }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
close
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
Apache-2.0
@Override public void handle(Future<Void> v) { if (count.decrementAndGet() == 0 && completionHandler != null) { completionHandler.handle(null); } }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
handle
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
Apache-2.0
private Process createProcess(Session session, List<CliToken> line, InternalCommandManager commandManager, int jobId, Term term, ResultDistributor resultDistributor) { try { ListIterator<CliToken> tokens = line.listIterator(); while (tokens.hasNext()) { CliToken token = tokens.next(); if (token.isText()) { // check before create process checkPermission(session, token); Command command = commandManager.getCommand(token.value()); if (command != null) { return createCommandProcess(command, tokens, jobId, term, resultDistributor); } else { throw new IllegalArgumentException(token.value() + ": command not found"); } } } throw new IllegalArgumentException(); } catch (Exception e) { throw new RuntimeException(e); } }
Try to create a process from the command line tokens. @param line the command line tokens @param commandManager command manager @param jobId job id @param term term @param resultDistributor @return the created process
createProcess
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
Apache-2.0
private boolean runInBackground(List<CliToken> tokens) { boolean runInBackground = false; CliToken last = TokenUtils.findLastTextToken(tokens); if (last != null && "&".equals(last.value())) { runInBackground = true; tokens.remove(last); } return runInBackground; }
Try to create a process from the command line tokens. @param line the command line tokens @param commandManager command manager @param jobId job id @param term term @param resultDistributor @return the created process
runInBackground
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
Apache-2.0
private String getRedirectFileName(ListIterator<CliToken> tokens) { while (tokens.hasNext()) { CliToken token = tokens.next(); if (token.isText()) { return token.value(); } } return null; }
Try to create a process from the command line tokens. @param line the command line tokens @param commandManager command manager @param jobId job id @param term term @param resultDistributor @return the created process
getRedirectFileName
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
Apache-2.0
private void injectHandler(List<Function<String, String>> stdoutHandlerChain, List<CliToken> pipelineTokens) { if (!pipelineTokens.isEmpty()) { StdoutHandler handler = StdoutHandler.inject(pipelineTokens); if (handler != null) { stdoutHandlerChain.add(handler); } pipelineTokens.clear(); } }
Try to create a process from the command line tokens. @param line the command line tokens @param commandManager command manager @param jobId job id @param term term @param resultDistributor @return the created process
injectHandler
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
Apache-2.0
@Override public void close() { close(null); }
Try to create a process from the command line tokens. @param line the command line tokens @param commandManager command manager @param jobId job id @param term term @param resultDistributor @return the created process
close
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java
Apache-2.0
public ExecStatus actualStatus() { return actualStatus; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
actualStatus
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public boolean interrupt() { return process.interrupt(); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
interrupt
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public Job resume() { return resume(true); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
resume
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public Date timeoutDate() { return timeoutDate; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
timeoutDate
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public void setTimeoutDate(Date date) { this.timeoutDate = date; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
setTimeoutDate
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public Session getSession() { return session; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
getSession
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public Job resume(boolean foreground) { try { process.resume(foreground, new ResumeHandler()); } catch (IllegalStateException ignore) { } runInBackground.set(!foreground); // if (foreground) { // if (foregroundUpdatedHandler != null) { // foregroundUpdatedHandler.handle(this); // } // } if (statusUpdateHandler != null) { statusUpdateHandler.handle(process.status()); } if (this.status() == ExecStatus.RUNNING) { if (foreground) { jobHandler.onForeground(this); } else { jobHandler.onBackground(this); } } return this; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
resume
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public Job suspend() { try { process.suspend(new SuspendHandler()); } catch (IllegalStateException ignore) { return this; } // if (!runInBackground.get() && foregroundUpdatedHandler != null) { // foregroundUpdatedHandler.handle(null); // } if (statusUpdateHandler != null) { statusUpdateHandler.handle(process.status()); } // shell.setForegroundJob(null); jobHandler.onSuspend(this); return this; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
suspend
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public void terminate() { try { process.terminate(); } catch (IllegalStateException ignore) { // Process already terminated, likely by itself } finally { controller.removeJob(this.id); } }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
terminate
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public Process process() { return process; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
process
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
public ExecStatus status() { return process.status(); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
status
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
public String line() { return line; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
line
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public boolean isRunInBackground() { return runInBackground.get(); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
isRunInBackground
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public Job toBackground() { if (!this.runInBackground.get()) { // run in foreground mode if (runInBackground.compareAndSet(false, true)) { process.toBackground(); if (statusUpdateHandler != null) { statusUpdateHandler.handle(process.status()); } jobHandler.onBackground(this); } } // shell.setForegroundJob(null); // jobHandler.onBackground(this); return this; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
toBackground
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public Job toForeground() { if (this.runInBackground.get()) { if (runInBackground.compareAndSet(true, false)) { // if (foregroundUpdatedHandler != null) { // foregroundUpdatedHandler.handle(this); // } process.toForeground(); if (statusUpdateHandler != null) { statusUpdateHandler.handle(process.status()); } // shell.setForegroundJob(this); jobHandler.onForeground(this); } } return this; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
toForeground
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public int id() { return id; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
id
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public Job run() { return run(!runInBackground.get()); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
run
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public Job run(boolean foreground) { // if (foreground && foregroundUpdatedHandler != null) { // foregroundUpdatedHandler.handle(this); // } actualStatus = ExecStatus.RUNNING; if (statusUpdateHandler != null) { statusUpdateHandler.handle(ExecStatus.RUNNING); } //set process's tty in JobControllerImpl.createCommandProcess //process.setTty(shell.term()); process.setSession(this.session); process.run(foreground); // if (!foreground && foregroundUpdatedHandler != null) { // foregroundUpdatedHandler.handle(null); // } // // if (foreground) { // shell.setForegroundJob(this); // } else { // shell.setForegroundJob(null); // } if (this.status() == ExecStatus.RUNNING) { if (foreground) { jobHandler.onForeground(this); } else { jobHandler.onBackground(this); } } return this; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
run
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public void handle(Void event) { actualStatus = ExecStatus.RUNNING; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
handle
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
@Override public void handle(Void event) { actualStatus = ExecStatus.STOPPED; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-05-14 @author gongdewei 2020-03-23
handle
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobImpl.java
Apache-2.0
public static TermServer createTelnetTermServer(Configure configure, ShellServerOptions options) { int port = configure.getTelnetPort() != null ? configure.getTelnetPort() : ArthasConstants.TELNET_PORT; return new TelnetTermServer(configure.getIp(), port, options.getConnectionTimeout()); }
Create a term server for the Telnet protocol. @param configure @return the term server
createTelnetTermServer
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/TermServer.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/TermServer.java
Apache-2.0
public static TermServer createHttpTermServer() { // TODO return null; }
Create a term server for the HTTP protocol, using an existing router. @return the term server
createHttpTermServer
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/TermServer.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/TermServer.java
Apache-2.0
public TermServer listen() { return listen(null); }
Bind the term server, the {@link #termHandler(Handler)} must be set before. @return this object
listen
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/TermServer.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/TermServer.java
Apache-2.0
public static Keymap loadKeymap() { return new Keymap(loadInputRcFile()); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
loadKeymap
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/Helper.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/Helper.java
Apache-2.0
public static InputStream loadInputRcFile() { InputStream inputrc; // step 1: load custom keymap file try { String customInputrc = System.getProperty("user.home") + "/.arthas/conf/inputrc"; inputrc = new FileInputStream(customInputrc); logger.info("Loaded custom keymap file from " + customInputrc); return inputrc; } catch (Throwable e) { // ignore } // step 2: load arthas default keymap file inputrc = TermServer.class.getClassLoader().getResourceAsStream(ShellServerOptions.DEFAULT_INPUTRC); if (inputrc != null) { logger.info("Loaded arthas keymap file from " + ShellServerOptions.DEFAULT_INPUTRC); return inputrc; } // step 3: fall back to termd default keymap file inputrc = Keymap.class.getResourceAsStream("inputrc"); if (inputrc != null) { return inputrc; } throw new IllegalStateException("Could not load inputrc file."); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
loadInputRcFile
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/Helper.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/Helper.java
Apache-2.0
@Override public TermServer termHandler(Handler<Term> handler) { termHandler = handler; return this; }
Encapsulate the Telnet server setup. @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
termHandler
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/TelnetTermServer.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/TelnetTermServer.java
Apache-2.0
@Override public TermServer listen(Handler<Future<TermServer>> listenHandler) { // TODO: charset and inputrc from options bootstrap = new NettyTelnetTtyBootstrap().setHost(hostIp).setPort(port); try { bootstrap.start(new Consumer<TtyConnection>() { @Override public void accept(final TtyConnection conn) { termHandler.handle(new TermImpl(Helper.loadKeymap(), conn)); } }).get(connectionTimeout, TimeUnit.MILLISECONDS); listenHandler.handle(Future.<TermServer>succeededFuture()); } catch (Throwable t) { logger.error("Error listening to port " + port, t); listenHandler.handle(Future.<TermServer>failedFuture(t)); } return this; }
Encapsulate the Telnet server setup. @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
listen
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/TelnetTermServer.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/TelnetTermServer.java
Apache-2.0
@Override public void accept(final TtyConnection conn) { termHandler.handle(new TermImpl(Helper.loadKeymap(), conn)); }
Encapsulate the Telnet server setup. @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
accept
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/TelnetTermServer.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/TelnetTermServer.java
Apache-2.0
@Override public void close() { close(null); }
Encapsulate the Telnet server setup. @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
close
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/TelnetTermServer.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/TelnetTermServer.java
Apache-2.0
@Override public void close(Handler<Future<Void>> completionHandler) { if (bootstrap != null) { bootstrap.stop(); if (completionHandler != null) { completionHandler.handle(Future.<Void>succeededFuture()); } } else { if (completionHandler != null) { completionHandler.handle(Future.<Void>failedFuture("telnet term server not started")); } } }
Encapsulate the Telnet server setup. @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
close
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/TelnetTermServer.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/TelnetTermServer.java
Apache-2.0
public int actualPort() { return bootstrap.getPort(); }
Encapsulate the Telnet server setup. @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
actualPort
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/TelnetTermServer.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/TelnetTermServer.java
Apache-2.0
protected static BasicPrincipal extractBasicAuthSubject(HttpRequest request) { String auth = request.headers().get(HttpHeaderNames.AUTHORIZATION); if (auth != null) { String constraint = StringUtils.before(auth, " "); if (constraint != null) { if ("Basic".equalsIgnoreCase(constraint.trim())) { String decoded = StringUtils.after(auth, " "); if (decoded == null) { logger.error("Extracted Basic Auth principal failed, bad auth String: {}", auth); return null; } // the decoded part is base64 encoded, so we need to decode that ByteBuf buf = Unpooled.wrappedBuffer(decoded.getBytes()); ByteBuf out = Base64.decode(buf); String userAndPw = out.toString(Charset.defaultCharset()); String username = StringUtils.before(userAndPw, ":"); String password = StringUtils.after(userAndPw, ":"); BasicPrincipal principal = new BasicPrincipal(username, password); logger.debug("Extracted Basic Auth principal from HTTP header: {}", principal); return principal; } } } return null; }
Extracts the username and password details from the HTTP basic header Authorization. <p/> This requires that the <tt>Authorization</tt> HTTP header is provided, and its using Basic. Currently Digest is <b>not</b> supported. @return {@link HttpPrincipal} with username and password details, or <tt>null</tt> if not possible to extract
extractBasicAuthSubject
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/BasicHttpAuthenticatorHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/BasicHttpAuthenticatorHandler.java
Apache-2.0
@Override public void operationProgressed(ChannelProgressiveFuture future, long progress, long total) { if (total < 0) { // total unknown logger.info(future.channel() + " Transfer progress: " + progress); } else { logger.info(future.channel() + " Transfer progress: " + progress + " / " + total); } }
write data here,still return not null just to know succeeded. @param dir @param path @param request @param ctx @return @throws IOException
operationProgressed
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java
Apache-2.0
@Override public void operationComplete(ChannelProgressiveFuture future) { logger.info(future.channel() + " Transfer complete."); }
write data here,still return not null just to know succeeded. @param dir @param path @param request @param ctx @return @throws IOException
operationComplete
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java
Apache-2.0
private static void setDateAndCacheHeaders(HttpResponse response, File fileToCache) { SimpleDateFormat dateFormatter = new SimpleDateFormat(HTTP_DATE_FORMAT, Locale.US); dateFormatter.setTimeZone(TimeZone.getTimeZone(HTTP_DATE_GMT_TIMEZONE)); // Date header Calendar time = new GregorianCalendar(); response.headers().set(HttpHeaderNames.DATE, dateFormatter.format(time.getTime())); // Add cache headers time.add(Calendar.SECOND, 3600); response.headers().set(HttpHeaderNames.EXPIRES, dateFormatter.format(time.getTime())); response.headers().set(HttpHeaderNames.CACHE_CONTROL, "private, max-age=" + 3600); response.headers().set( HttpHeaderNames.LAST_MODIFIED, dateFormatter.format(new Date(fileToCache.lastModified()))); }
write data here,still return not null just to know succeeded. @param dir @param path @param request @param ctx @return @throws IOException
setDateAndCacheHeaders
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java
Apache-2.0
public static boolean isSubFile(File parent, File child) throws IOException { String parentPath = parent.getCanonicalPath(); String childPath = child.getCanonicalPath(); if (parentPath.equals(childPath) || childPath.startsWith(parent.getCanonicalPath() + File.separator)) { return true; } return false; }
write data here,still return not null just to know succeeded. @param dir @param path @param request @param ctx @return @throws IOException
isSubFile
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java
Apache-2.0
public static boolean isSameFile(File a, File b) { try { return a.getCanonicalPath().equals(b.getCanonicalPath()); } catch (IOException e) { return false; } }
write data here,still return not null just to know succeeded. @param dir @param path @param request @param ctx @return @throws IOException
isSameFile
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java
Apache-2.0
@Override protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest request) throws Exception { String path = new URI(request.uri()).getPath(); if (wsUri.equalsIgnoreCase(path)) { ctx.fireChannelRead(request.retain()); } else { if (HttpUtil.is100ContinueExpected(request)) { send100Continue(ctx); } HttpResponse response = null; if ("/".equals(path)) { path = "/index.html"; } boolean isFileResponseFinished = false; try { //handle http restful api if ("/api".equals(path)) { response = httpApiHandler.handle(ctx, request); } //handle webui requests if (path.equals("/ui")) { response = createRedirectResponse(request, "/ui/"); } if (path.equals("/ui/")) { path += "index.html"; } //try classpath resource first if (response == null) { response = readFileFromResource(request, path); } //try output dir later, avoid overlay classpath resources files if (response == null) { response = DirectoryBrowser.directView(dir, path, request, ctx); isFileResponseFinished = response != null; } //not found if (response == null) { response = createResponse(request, HttpResponseStatus.NOT_FOUND, "Not found"); } } catch (Throwable e) { logger.error("arthas process http request error: " + request.uri(), e); } finally { //If it is null, an error may occur if (response == null) { response = createResponse(request, HttpResponseStatus.INTERNAL_SERVER_ERROR, "Server error"); } if (!isFileResponseFinished) { ChannelFuture future = writeResponse(ctx, response); future.addListener(ChannelFutureListener.CLOSE); } } } }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-06 @author gongdewei 2020-03-18
channelRead0
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/HttpRequestHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/HttpRequestHandler.java
Apache-2.0
private ChannelFuture writeResponse(ChannelHandlerContext ctx, HttpResponse response) { // try to add content-length header for DefaultFullHttpResponse if (!HttpUtil.isTransferEncodingChunked(response) && response instanceof DefaultFullHttpResponse) { response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); response.headers().set(HttpHeaderNames.CONTENT_LENGTH, ((DefaultFullHttpResponse) response).content().readableBytes()); return ctx.writeAndFlush(response); } //chunk response ctx.write(response); return ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-06 @author gongdewei 2020-03-18
writeResponse
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/HttpRequestHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/HttpRequestHandler.java
Apache-2.0
private HttpResponse readFileFromResource(FullHttpRequest request, String path) throws IOException { DefaultFullHttpResponse fullResp = null; InputStream in = null; try { URL res = HttpTtyConnection.class.getResource("/com/taobao/arthas/core/http" + path); if (res != null) { fullResp = new DefaultFullHttpResponse(request.protocolVersion(), HttpResponseStatus.OK); in = res.openStream(); byte[] tmp = new byte[256]; for (int l = 0; l != -1; l = in.read(tmp)) { fullResp.content().writeBytes(tmp, 0, l); } int li = path.lastIndexOf('.'); if (li != -1 && li != path.length() - 1) { String ext = path.substring(li + 1); String contentType; if ("html".equals(ext)) { contentType = "text/html"; } else if ("js".equals(ext)) { contentType = "application/javascript"; } else if ("css".equals(ext)) { contentType = "text/css"; } else { contentType = null; } if (contentType != null) { fullResp.headers().set(HttpHeaderNames.CONTENT_TYPE, contentType); } } } } finally { IOUtils.close(in); } return fullResp; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-06 @author gongdewei 2020-03-18
readFileFromResource
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/HttpRequestHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/HttpRequestHandler.java
Apache-2.0
private static void send100Continue(ChannelHandlerContext ctx) { FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, HttpResponseStatus.CONTINUE); ctx.writeAndFlush(response); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-06 @author gongdewei 2020-03-18
send100Continue
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/HttpRequestHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/HttpRequestHandler.java
Apache-2.0
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { Logging.logReportedIoError(cause); ctx.close(); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-06 @author gongdewei 2020-03-18
exceptionCaught
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/HttpRequestHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/HttpRequestHandler.java
Apache-2.0
public String getHost() { return host; }
Convenience class for quickly starting a Netty Tty server. @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
getHost
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
Apache-2.0
public NettyWebsocketTtyBootstrap setHost(String host) { this.host = host; return this; }
Convenience class for quickly starting a Netty Tty server. @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
setHost
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
Apache-2.0
public int getPort() { return port; }
Convenience class for quickly starting a Netty Tty server. @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
getPort
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
Apache-2.0
public NettyWebsocketTtyBootstrap setPort(int port) { this.port = port; return this; }
Convenience class for quickly starting a Netty Tty server. @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
setPort
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
Apache-2.0
@Override public void operationComplete(Future<? super Void> future) throws Exception { if (future.isSuccess()) { channel = f.channel(); doneHandler.accept(null); } else { doneHandler.accept(future.cause()); } }
Convenience class for quickly starting a Netty Tty server. @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
operationComplete
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
Apache-2.0
@Override public void operationComplete(Future<? super Void> future) throws Exception { if (future.isSuccess()) { doneHandler.accept(null); } else { doneHandler.accept(future.cause()); } }
Convenience class for quickly starting a Netty Tty server. @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
operationComplete
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
Apache-2.0
public CompletableFuture<Void> start(Consumer<TtyConnection> handler) { CompletableFuture<Void> fut = new CompletableFuture<Void>(); start(handler, Helper.startedHandler(fut)); return fut; }
Convenience class for quickly starting a Netty Tty server. @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
start
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
Apache-2.0
public void stop(final Consumer<Throwable> doneHandler) { if (channel != null) { channel.close(); } channelGroup.close().addListener(new GenericFutureListener<Future<? super Void>>() { @Override public void operationComplete(Future<? super Void> future) throws Exception { try { doneHandler.accept(future.cause()); } finally { group.shutdownGracefully(); } } }); }
Convenience class for quickly starting a Netty Tty server. @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
stop
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
Apache-2.0
@Override public void operationComplete(Future<? super Void> future) throws Exception { try { doneHandler.accept(future.cause()); } finally { group.shutdownGracefully(); } }
Convenience class for quickly starting a Netty Tty server. @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
operationComplete
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
Apache-2.0
public CompletableFuture<Void> stop() { CompletableFuture<Void> fut = new CompletableFuture<Void>(); stop(Helper.stoppedHandler(fut)); return fut; }
Convenience class for quickly starting a Netty Tty server. @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
stop
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/NettyWebsocketTtyBootstrap.java
Apache-2.0
@Override protected void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new HttpServerCodec()); pipeline.addLast(new ChunkedWriteHandler()); pipeline.addLast(new HttpObjectAggregator(ArthasConstants.MAX_HTTP_CONTENT_LENGTH)); pipeline.addLast(new BasicHttpAuthenticatorHandler(httpSessionManager)); pipeline.addLast(workerGroup, "HttpRequestHandler", new HttpRequestHandler(ArthasConstants.DEFAULT_WEBSOCKET_PATH)); pipeline.addLast(new WebSocketServerProtocolHandler(ArthasConstants.DEFAULT_WEBSOCKET_PATH, null, false, ArthasConstants.MAX_HTTP_CONTENT_LENGTH, false, true)); pipeline.addLast(new IdleStateHandler(0, 0, ArthasConstants.WEBSOCKET_IDLE_SECONDS)); pipeline.addLast(new TtyWebSocketFrameHandler(group, handler)); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
initChannel
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/TtyServerInitializer.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/TtyServerInitializer.java
Apache-2.0
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception { super.channelActive(ctx); context = ctx; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
channelActive
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/TtyWebSocketFrameHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/TtyWebSocketFrameHandler.java
Apache-2.0
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt == WebSocketServerProtocolHandler.ServerHandshakeStateEvent.HANDSHAKE_COMPLETE) { ctx.pipeline().remove(HttpRequestHandler.class); group.add(ctx.channel()); conn = new ExtHttpTtyConnection(context); handler.accept(conn); } else if (evt instanceof IdleStateEvent) { ctx.writeAndFlush(new PingWebSocketFrame()); } else { super.userEventTriggered(ctx, evt); } }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
userEventTriggered
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/TtyWebSocketFrameHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/TtyWebSocketFrameHandler.java
Apache-2.0
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { HttpTtyConnection tmp = conn; context = null; conn = null; if (tmp != null) { Consumer<Void> closeHandler = tmp.getCloseHandler(); if (closeHandler != null) { closeHandler.accept(null); } } }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
channelInactive
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/TtyWebSocketFrameHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/TtyWebSocketFrameHandler.java
Apache-2.0
@Override public void channelRead0(ChannelHandlerContext ctx, TextWebSocketFrame msg) throws Exception { conn.writeToDecoder(msg.text()); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a>
channelRead0
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/TtyWebSocketFrameHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/TtyWebSocketFrameHandler.java
Apache-2.0
public HttpResponse handle(ChannelHandlerContext ctx, FullHttpRequest request) throws Exception { ApiResponse result; String requestBody = null; String requestId = null; try { HttpMethod method = request.method(); if (HttpMethod.POST.equals(method)) { requestBody = getBody(request); ApiRequest apiRequest = parseRequest(requestBody); requestId = apiRequest.getRequestId(); result = processRequest(ctx, apiRequest); } else { result = createResponse(ApiState.REFUSED, "Unsupported http method: " + method.name()); } } catch (Throwable e) { result = createResponse(ApiState.FAILED, "Process request error: " + e.getMessage()); logger.error("arthas process http api request error: " + request.uri() + ", request body: " + requestBody, e); } if (result == null) { result = createResponse(ApiState.FAILED, "The request was not processed"); } result.setRequestId(requestId); byte[] jsonBytes = JSON.toJSONBytes(result, JSON_FILTERS); // create http response DefaultFullHttpResponse response = new DefaultFullHttpResponse(request.protocolVersion(), HttpResponseStatus.OK, Unpooled.wrappedBuffer(jsonBytes)); response.headers().set(HttpHeaderNames.CONTENT_TYPE, "application/json; charset=utf-8"); return response; }
Http Restful Api Handler @author gongdewei 2020-03-18
handle
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
Apache-2.0
private ApiRequest parseRequest(String requestBody) throws ApiException { if (StringUtils.isBlank(requestBody)) { throw new ApiException("parse request failed: request body is empty"); } try { //ObjectMapper objectMapper = new ObjectMapper(); //return objectMapper.readValue(requestBody, ApiRequest.class); return JSON.parseObject(requestBody, ApiRequest.class); } catch (Exception e) { throw new ApiException("parse request failed: " + e.getMessage(), e); } }
Http Restful Api Handler @author gongdewei 2020-03-18
parseRequest
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
Apache-2.0
private ApiResponse dispatchRequest(ApiAction action, ApiRequest apiRequest, Session session) throws ApiException { switch (action) { case EXEC: return processExecRequest(apiRequest, session); case ASYNC_EXEC: return processAsyncExecRequest(apiRequest, session); case INTERRUPT_JOB: return processInterruptJob(apiRequest, session); case PULL_RESULTS: return processPullResultsRequest(apiRequest, session); case SESSION_INFO: return processSessionInfoRequest(apiRequest, session); case JOIN_SESSION: return processJoinSessionRequest(apiRequest, session); case CLOSE_SESSION: return processCloseSessionRequest(apiRequest, session); case INIT_SESSION: break; } return null; }
Http Restful Api Handler @author gongdewei 2020-03-18
dispatchRequest
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
Apache-2.0
private ApiResponse processInitSessionRequest(ApiRequest apiRequest) throws ApiException { ApiResponse response = new ApiResponse(); //create session Session session = sessionManager.createSession(); if (session != null) { //Result Distributor SharingResultDistributorImpl resultDistributor = new SharingResultDistributorImpl(session); //create consumer ResultConsumer resultConsumer = new ResultConsumerImpl(); resultDistributor.addConsumer(resultConsumer); session.setResultDistributor(resultDistributor); resultDistributor.appendResult(new MessageModel("Welcome to arthas!")); //welcome message WelcomeModel welcomeModel = new WelcomeModel(); welcomeModel.setVersion(ArthasBanner.version()); welcomeModel.setWiki(ArthasBanner.wiki()); welcomeModel.setTutorials(ArthasBanner.tutorials()); welcomeModel.setMainClass(PidUtils.mainClass()); welcomeModel.setPid(PidUtils.currentPid()); welcomeModel.setTime(DateUtils.getCurrentDateTime()); resultDistributor.appendResult(welcomeModel); //allow input updateSessionInputStatus(session, InputStatus.ALLOW_INPUT); response.setSessionId(session.getSessionId()) .setConsumerId(resultConsumer.getConsumerId()) .setState(ApiState.SUCCEEDED); } else { throw new ApiException("create api session failed"); } return response; }
Http Restful Api Handler @author gongdewei 2020-03-18
processInitSessionRequest
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
Apache-2.0
private void updateSessionInputStatus(Session session, InputStatus inputStatus) { SharingResultDistributor resultDistributor = session.getResultDistributor(); if (resultDistributor != null) { resultDistributor.appendResult(new InputStatusModel(inputStatus)); } }
Update session input status for all consumer @param session @param inputStatus
updateSessionInputStatus
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
Apache-2.0
private ApiResponse processJoinSessionRequest(ApiRequest apiRequest, Session session) { //create consumer ResultConsumer resultConsumer = new ResultConsumerImpl(); //disable input and interrupt resultConsumer.appendResult(new InputStatusModel(InputStatus.DISABLED)); SharingResultDistributor resultDistributor = session.getResultDistributor(); if (resultDistributor != null) { resultDistributor.addConsumer(resultConsumer); } ApiResponse response = new ApiResponse(); response.setSessionId(session.getSessionId()) .setConsumerId(resultConsumer.getConsumerId()) .setState(ApiState.SUCCEEDED); return response; }
Update session input status for all consumer @param session @param inputStatus
processJoinSessionRequest
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
Apache-2.0
private ApiResponse processSessionInfoRequest(ApiRequest apiRequest, Session session) { ApiResponse response = new ApiResponse(); Map<String, Object> body = new TreeMap<String, Object>(); body.put("pid", session.getPid()); body.put("createTime", session.getCreateTime()); body.put("lastAccessTime", session.getLastAccessTime()); response.setState(ApiState.SUCCEEDED) .setSessionId(session.getSessionId()) //.setConsumerId(consumerId) .setBody(body); return response; }
Update session input status for all consumer @param session @param inputStatus
processSessionInfoRequest
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
Apache-2.0
private ApiResponse processCloseSessionRequest(ApiRequest apiRequest, Session session) { sessionManager.removeSession(session.getSessionId()); ApiResponse response = new ApiResponse(); response.setState(ApiState.SUCCEEDED); return response; }
Update session input status for all consumer @param session @param inputStatus
processCloseSessionRequest
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
Apache-2.0
private ApiResponse processExecRequest(ApiRequest apiRequest, Session session) { boolean oneTimeAccess = false; if (session.get(ONETIME_SESSION_KEY) != null) { oneTimeAccess = true; } try { String commandLine = apiRequest.getCommand(); Map<String, Object> body = new TreeMap<String, Object>(); body.put("command", commandLine); ApiResponse response = new ApiResponse(); response.setSessionId(session.getSessionId()) .setBody(body); if (!session.tryLock()) { response.setState(ApiState.REFUSED) .setMessage("Another command is executing."); return response; } int lock = session.getLock(); PackingResultDistributor packingResultDistributor = null; Job job = null; try { Job foregroundJob = session.getForegroundJob(); if (foregroundJob != null) { response.setState(ApiState.REFUSED) .setMessage("Another job is running."); logger.info("Another job is running, jobId: {}", foregroundJob.id()); return response; } packingResultDistributor = new PackingResultDistributorImpl(session); //distribute result message both to origin session channel and request channel by CompositeResultDistributor //ResultDistributor resultDistributor = new CompositeResultDistributorImpl(packingResultDistributor, session.getResultDistributor()); job = this.createJob(commandLine, session, packingResultDistributor); session.setForegroundJob(job); updateSessionInputStatus(session, InputStatus.ALLOW_INTERRUPT); job.run(); } catch (Throwable e) { logger.error("Exec command failed:" + e.getMessage() + ", command:" + commandLine, e); response.setState(ApiState.FAILED).setMessage("Exec command failed:" + e.getMessage()); return response; } finally { if (session.getLock() == lock) { session.unLock(); } } //wait for job completed or timeout Integer timeout = apiRequest.getExecTimeout(); if (timeout == null || timeout <= 0) { timeout = DEFAULT_EXEC_TIMEOUT; } boolean timeExpired = !waitForJob(job, timeout); if (timeExpired) { logger.warn("Job is exceeded time limit, force interrupt it, jobId: {}", job.id()); job.interrupt(); response.setState(ApiState.INTERRUPTED).setMessage("The job is exceeded time limit, force interrupt"); } else { response.setState(ApiState.SUCCEEDED); } //packing results body.put("jobId", job.id()); body.put("jobStatus", job.status()); body.put("timeExpired", timeExpired); if (timeExpired) { body.put("timeout", timeout); } body.put("results", packingResultDistributor.getResults()); response.setSessionId(session.getSessionId()) //.setConsumerId(consumerId) .setBody(body); return response; } finally { if (oneTimeAccess) { sessionManager.removeSession(session.getSessionId()); } } }
Execute command sync, wait for job finish or timeout, sending results immediately @param apiRequest @param session @return
processExecRequest
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
Apache-2.0
private ApiResponse processAsyncExecRequest(ApiRequest apiRequest, Session session) { String commandLine = apiRequest.getCommand(); Map<String, Object> body = new TreeMap<String, Object>(); body.put("command", commandLine); ApiResponse response = new ApiResponse(); response.setSessionId(session.getSessionId()) .setBody(body); if (!session.tryLock()) { response.setState(ApiState.REFUSED) .setMessage("Another command is executing."); return response; } int lock = session.getLock(); try { Job foregroundJob = session.getForegroundJob(); if (foregroundJob != null) { response.setState(ApiState.REFUSED) .setMessage("Another job is running."); logger.info("Another job is running, jobId: {}", foregroundJob.id()); return response; } //create job Job job = this.createJob(commandLine, session, session.getResultDistributor()); body.put("jobId", job.id()); body.put("jobStatus", job.status()); response.setState(ApiState.SCHEDULED); //add command before exec job CommandRequestModel commandRequestModel = new CommandRequestModel(commandLine, response.getState()); commandRequestModel.setJobId(job.id()); SharingResultDistributor resultDistributor = session.getResultDistributor(); if (resultDistributor != null) { resultDistributor.appendResult(commandRequestModel); } session.setForegroundJob(job); updateSessionInputStatus(session, InputStatus.ALLOW_INTERRUPT); //run job job.run(); return response; } catch (Throwable e) { logger.error("Async exec command failed:" + e.getMessage() + ", command:" + commandLine, e); response.setState(ApiState.FAILED).setMessage("Async exec command failed:" + e.getMessage()); CommandRequestModel commandRequestModel = new CommandRequestModel(commandLine, response.getState(), response.getMessage()); session.getResultDistributor().appendResult(commandRequestModel); return response; } finally { if (session.getLock() == lock) { session.unLock(); } } }
Execute command async, create and schedule the job running, but no wait for the results. @param apiRequest @param session @return
processAsyncExecRequest
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
Apache-2.0
private ApiResponse processInterruptJob(ApiRequest apiRequest, Session session) { Job job = session.getForegroundJob(); if (job == null) { return new ApiResponse().setState(ApiState.FAILED).setMessage("no foreground job is running"); } job.interrupt(); Map<String, Object> body = new TreeMap<String, Object>(); body.put("jobId", job.id()); body.put("jobStatus", job.status()); return new ApiResponse() .setState(ApiState.SUCCEEDED) .setBody(body); }
Execute command async, create and schedule the job running, but no wait for the results. @param apiRequest @param session @return
processInterruptJob
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
Apache-2.0
private ApiResponse processPullResultsRequest(ApiRequest apiRequest, Session session) throws ApiException { String consumerId = apiRequest.getConsumerId(); if (StringUtils.isBlank(consumerId)) { throw new ApiException("'consumerId' is required"); } ResultConsumer consumer = null; SharingResultDistributor resultDistributor = session.getResultDistributor(); if (resultDistributor != null) { consumer = resultDistributor.getConsumer(consumerId); } if (consumer == null) { throw new ApiException("consumer not found: " + consumerId); } List<ResultModel> results = consumer.pollResults(); Map<String, Object> body = new TreeMap<String, Object>(); body.put("results", results); ApiResponse response = new ApiResponse(); response.setState(ApiState.SUCCEEDED) .setSessionId(session.getSessionId()) .setConsumerId(consumerId) .setBody(body); return response; }
Pull results from result queue @param apiRequest @param session @return
processPullResultsRequest
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/api/HttpApiHandler.java
Apache-2.0