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
private boolean waitForJob(Job job, int timeout) { long startTime = System.currentTimeMillis(); while (true) { switch (job.status()) { case STOPPED: case TERMINATED: return true; } if (System.currentTimeMillis() - st...
Pull results from result queue @param apiRequest @param session @return
waitForJob
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 synchronized Job createJob(List<CliToken> args, Session session, ResultDistributor resultDistributor) { Job job = jobController.createJob(commandManager, args, session, new ApiJobHandler(session), new ApiTerm(session), resultDistributor); return job; }
Pull results from result queue @param apiRequest @param session @return
createJob
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 Job createJob(String line, Session session, ResultDistributor resultDistributor) { historyManager.addHistory(line); return createJob(CliTokens.tokenize(line), session, resultDistributor); }
Pull results from result queue @param apiRequest @param session @return
createJob
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 createResponse(ApiState apiState, String message) { ApiResponse apiResponse = new ApiResponse(); apiResponse.setState(apiState); apiResponse.setMessage(message); return apiResponse; }
Pull results from result queue @param apiRequest @param session @return
createResponse
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 String getBody(FullHttpRequest request) { ByteBuf buf = request.content(); return buf.toString(CharsetUtil.UTF_8); }
Pull results from result queue @param apiRequest @param session @return
getBody
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
@Override public void onForeground(Job job) { session.setForegroundJob(job); }
Pull results from result queue @param apiRequest @param session @return
onForeground
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
@Override public void onBackground(Job job) { if (session.getForegroundJob() == job) { session.setForegroundJob(null); updateSessionInputStatus(session, InputStatus.ALLOW_INPUT); } }
Pull results from result queue @param apiRequest @param session @return
onBackground
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
@Override public void onTerminated(Job job) { if (session.getForegroundJob() == job) { session.setForegroundJob(null); updateSessionInputStatus(session, InputStatus.ALLOW_INPUT); } }
Pull results from result queue @param apiRequest @param session @return
onTerminated
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
@Override public void onSuspend(Job job) { if (session.getForegroundJob() == job) { session.setForegroundJob(null); updateSessionInputStatus(session, InputStatus.ALLOW_INPUT); } }
Pull results from result queue @param apiRequest @param session @return
onSuspend
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
@Override public Term resizehandler(Handler<Void> handler) { return this; }
Pull results from result queue @param apiRequest @param session @return
resizehandler
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
@Override public String type() { return "web"; }
Pull results from result queue @param apiRequest @param session @return
type
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
@Override public int width() { return 1000; }
Pull results from result queue @param apiRequest @param session @return
width
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
@Override public int height() { return 200; }
Pull results from result queue @param apiRequest @param session @return
height
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
@Override public Term stdinHandler(Handler<String> handler) { return this; }
Pull results from result queue @param apiRequest @param session @return
stdinHandler
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
@Override public Term stdoutHandler(Function<String, String> handler) { return this; }
Pull results from result queue @param apiRequest @param session @return
stdoutHandler
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
@Override public Term write(String data) { return this; }
Pull results from result queue @param apiRequest @param session @return
write
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
@Override public long lastAccessedTime() { return session.getLastAccessTime(); }
Pull results from result queue @param apiRequest @param session @return
lastAccessedTime
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
@Override public Term echo(String text) { return this; }
Pull results from result queue @param apiRequest @param session @return
echo
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
@Override public Term setSession(Session session) { return this; }
Pull results from result queue @param apiRequest @param session @return
setSession
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
@Override public Term interruptHandler(SignalHandler handler) { return this; }
Pull results from result queue @param apiRequest @param session @return
interruptHandler
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
@Override public Term suspendHandler(SignalHandler handler) { return this; }
Pull results from result queue @param apiRequest @param session @return
suspendHandler
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
@Override public void readline(String prompt, Handler<String> lineHandler) { }
Pull results from result queue @param apiRequest @param session @return
readline
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
@Override public void readline(String prompt, Handler<String> lineHandler, Handler<Completion> completionHandler) { }
Pull results from result queue @param apiRequest @param session @return
readline
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
@Override public Term closeHandler(Handler<Void> handler) { return this; }
Pull results from result queue @param apiRequest @param session @return
closeHandler
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
@Override public void close() { }
Pull results from result queue @param apiRequest @param session @return
close
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
@Override protected boolean removeEldestEntry(Map.Entry<K, V> eldest) { return size() > LRUCache.this.cacheSize; }
Creates a new LRU cache. @param cacheSize the maximum number of entries that will be kept in this cache.
removeEldestEntry
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/session/LRUCache.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/session/LRUCache.java
Apache-2.0
public synchronized V get(K key) { return map.get(key); }
Retrieves an entry from the cache.<br> The retrieved entry becomes the MRU (most recently used) entry. @param key the key whose associated value is to be returned. @return the value associated to this key, or null if no value with this key exists in the cache.
get
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/session/LRUCache.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/session/LRUCache.java
Apache-2.0
public synchronized void put(K key, V value) { map.put(key, value); }
Adds an entry to this cache. The new entry becomes the MRU (most recently used) entry. If an entry with the specified key already exists in the cache, it is replaced by the new entry. If the cache is full, the LRU (least recently used) entry is removed from the cache. @param key the key with which the specified valu...
put
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/session/LRUCache.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/session/LRUCache.java
Apache-2.0
public synchronized int usedEntries() { return map.size(); }
Returns the number of used entries in the cache. @return the number of entries currently in the cache.
usedEntries
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/session/LRUCache.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/session/LRUCache.java
Apache-2.0
public synchronized Collection<Map.Entry<K, V>> getAll() { return new ArrayList<Map.Entry<K, V>>(map.entrySet()); }
Returns a <code>Collection</code> that contains a copy of all cache entries. @return a <code>Collection</code> with a copy of the cache content.
getAll
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/session/LRUCache.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/session/LRUCache.java
Apache-2.0
@Override public TermServer termHandler(Handler<Term> handler) { this.termHandler = handler; return this; }
both suport http/telnet @author hengyunabc 2019-11-04
termHandler
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/HttpTelnetTermServer.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/HttpTelnetTermServer.java
Apache-2.0
@Override public TermServer listen(Handler<Future<TermServer>> listenHandler) { // TODO: charset and inputrc from options bootstrap = new NettyHttpTelnetTtyBootstrap(workerGroup, httpSessionManager).setHost(hostIp).setPort(port); try { bootstrap.start(new Consumer<TtyConnection>(...
both suport http/telnet @author hengyunabc 2019-11-04
listen
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/HttpTelnetTermServer.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/HttpTelnetTermServer.java
Apache-2.0
@Override public void accept(final TtyConnection conn) { termHandler.handle(new TermImpl(Helper.loadKeymap(), conn)); }
both suport http/telnet @author hengyunabc 2019-11-04
accept
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/HttpTelnetTermServer.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/HttpTelnetTermServer.java
Apache-2.0
@Override public int actualPort() { return bootstrap.getPort(); }
both suport http/telnet @author hengyunabc 2019-11-04
actualPort
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/HttpTelnetTermServer.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/HttpTelnetTermServer.java
Apache-2.0
@Override public void close() { close(null); }
both suport http/telnet @author hengyunabc 2019-11-04
close
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/HttpTelnetTermServer.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/HttpTelnetTermServer.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 (completionHandle...
both suport http/telnet @author hengyunabc 2019-11-04
close
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/HttpTelnetTermServer.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/HttpTelnetTermServer.java
Apache-2.0
public NettyHttpTelnetBootstrap setHost(String host) { return (NettyHttpTelnetBootstrap) super.setHost(host); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-05
setHost
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetBootstrap.java
Apache-2.0
public NettyHttpTelnetBootstrap setPort(int port) { return (NettyHttpTelnetBootstrap) super.setPort(port); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-05
setPort
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetBootstrap.java
Apache-2.0
@Override public void start(Supplier<TelnetHandler> factory, Consumer<Throwable> doneHandler) { // ignore, never invoke }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-05
start
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetBootstrap.java
Apache-2.0
public void start(final Supplier<TelnetHandler> handlerFactory, final Consumer<TtyConnection> factory, final Consumer<Throwable> doneHandler) { ServerBootstrap boostrap = new ServerBootstrap(); boostrap.group(group).channel(NioServerSocketChannel.class).option(ChannelOption.SO_BACKLO...
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-05
start
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetBootstrap.java
Apache-2.0
@Override public void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new ProtocolDetectHandler(channelGroup, handlerFactory, factory, workerGroup, httpSessionManager)); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-05
initChannel
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetBootstrap.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()); } }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-05
operationComplete
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetBootstrap.java
Apache-2.0
@Override public void stop(final Consumer<Throwable> doneHandler) { GenericFutureListener<Future<Object>> adapter = new GenericFutureListener<Future<Object>>() { @Override public void operationComplete(Future<Object> future) throws Exception { try { ...
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-05
stop
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetBootstrap.java
Apache-2.0
@Override public void operationComplete(Future<Object> future) throws Exception { try { doneHandler.accept(future.cause()); } finally { group.shutdownGracefully(); } }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-05
operationComplete
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetBootstrap.java
Apache-2.0
public String getHost() { return httpTelnetTtyBootstrap.getHost(); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-05
getHost
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetTtyBootstrap.java
Apache-2.0
public NettyHttpTelnetTtyBootstrap setHost(String host) { httpTelnetTtyBootstrap.setHost(host); return this; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-05
setHost
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetTtyBootstrap.java
Apache-2.0
public int getPort() { return httpTelnetTtyBootstrap.getPort(); }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-05
getPort
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetTtyBootstrap.java
Apache-2.0
public NettyHttpTelnetTtyBootstrap setPort(int port) { httpTelnetTtyBootstrap.setPort(port); return this; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-05
setPort
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetTtyBootstrap.java
Apache-2.0
public boolean isOutBinary() { return outBinary; }
@author <a href="mailto:julien@julienviet.com">Julien Viet</a> @author hengyunabc 2019-11-05
isOutBinary
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetTtyBootstrap.java
Apache-2.0
public NettyHttpTelnetTtyBootstrap setOutBinary(boolean outBinary) { this.outBinary = outBinary; return this; }
Enable or disable the TELNET BINARY option on output. @param outBinary true to require the client to receive binary @return this object
setOutBinary
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetTtyBootstrap.java
Apache-2.0
public boolean isInBinary() { return inBinary; }
Enable or disable the TELNET BINARY option on output. @param outBinary true to require the client to receive binary @return this object
isInBinary
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetTtyBootstrap.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/shell/term/impl/httptelnet/NettyHttpTelnetTtyBootstrap.java
Apache-2.0
private static URLConnection openURLConnection(String url) throws MalformedURLException, IOException { URLConnection connection = new URL(url).openConnection(); if (connection instanceof HttpURLConnection) { connection.setConnectTimeout(CONNECTION_TIMEOUT); connection.setReadTime...
support redirect @param url @return @throws MalformedURLException @throws IOException
openURLConnection
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/ArthasBanner.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/ArthasBanner.java
Apache-2.0
public static <E> boolean isIn(E e, E... s) { if (null != s) { for (E es : s) { if (isEquals(e, es)) { return true; } } } return false; }
check whether a component is in an Array<br/> @param e component @param s array @param <E> component type @return <br/> (1,1,2,3) == true (1,2,3,4) == false (null,1,null,2) == true (1,null) == false
isIn
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/ArthasCheckUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/ArthasCheckUtils.java
Apache-2.0
public static <E> boolean isEquals(E src, E target) { return null == src && null == target || null != src && null != target && src.equals(target); }
check whether two components are equal<br/> @param src source component @param target target component @param <E> component type @return <br/> (null, null) == true (1L,2L) == false (1L,1L) == true ("abc",null) == false (null,"abc") == false
isEquals
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/ArthasCheckUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/ArthasCheckUtils.java
Apache-2.0
public static List<ClassLoader> getClassLoader(Instrumentation inst, String classLoaderClassName, String classLoaderToString) { List<ClassLoader> matchClassLoaders = new ArrayList<ClassLoader>(); if (StringUtils.isEmpty(classLoaderClassName) && StringUtils.isEmpty(classLoaderToString)) { ret...
Find List<ClassLoader> by the class name of ClassLoader or the return value of ClassLoader#toString(). @param inst @param classLoaderClassName @param classLoaderToString @return
getClassLoader
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/ClassLoaderUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/ClassLoaderUtils.java
Apache-2.0
@SuppressWarnings({ "unchecked", "restriction" }) public static URL[] getUrls(ClassLoader classLoader) { if (classLoader instanceof URLClassLoader) { try { return ((URLClassLoader) classLoader).getURLs(); } catch (Throwable e) { logger.error("classLoad...
Find List<ClassLoader> by the class name of ClassLoader or the return value of ClassLoader#toString(). @param inst @param classLoaderClassName @param classLoaderToString @return
getUrls
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/ClassLoaderUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/ClassLoaderUtils.java
Apache-2.0
public static void end(CommandProcess process, ExitStatus status) { if (status != null) { process.end(status.getStatusCode(), status.getMessage()); } else { process.end(-1, "process error, exit status is null"); } }
check exit status and end command processing @param process CommandProcess instance @param status ExitStatus of command
end
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/CommandUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/CommandUtils.java
Apache-2.0
public static String decompile(String classFilePath, String methodName, boolean hideUnicode, boolean printLineNumber) { return decompileWithMappings(classFilePath, methodName, hideUnicode, printLineNumber).getFirst(); }
@see org.benf.cfr.reader.util.MiscConstants.Version.getVersion() Currently, the cfr version is wrong. so disable show cfr version.
decompile
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/Decompiler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/Decompiler.java
Apache-2.0
private static String addLineNumber(String src, Map<Integer, Integer> lineMapping) { int maxLineNumber = 0; for (Integer value : lineMapping.values()) { if (value != null && value > maxLineNumber) { maxLineNumber = value; } } String formatStr = "/...
@see org.benf.cfr.reader.util.MiscConstants.Version.getVersion() Currently, the cfr version is wrong. so disable show cfr version.
addLineNumber
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/Decompiler.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/Decompiler.java
Apache-2.0
public static void writeByteArrayToFile(File file, byte[] data) throws IOException { writeByteArrayToFile(file, data, false); }
Writes a byte array to a file creating the file if it does not exist. <p> NOTE: As from v1.3, the parent directories of the file will be created if they do not exist. @param file the file to write to @param data the content to write to the file @throws IOException in case of an I/O error @since 1.1
writeByteArrayToFile
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
Apache-2.0
public static void writeByteArrayToFile(File file, byte[] data, boolean append) throws IOException { try (OutputStream out = openOutputStream(file, append)) { out.write(data); } // ignore }
Writes a byte array to a file creating the file if it does not exist. @param file the file to write to @param data the content to write to the file @param append if {@code true}, then bytes will be added to the end of the file rather than overwriting @throws IOException in case of an I/O error @since IO 2.1
writeByteArrayToFile
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
Apache-2.0
public static FileOutputStream openOutputStream(File file, boolean append) throws IOException { if (file.exists()) { if (file.isDirectory()) { throw new IOException("File '" + file + "' exists but is a directory"); } if (!file.canWrite()) { thr...
Opens a {@link FileOutputStream} for the specified file, checking and creating the parent directory if it does not exist. <p> At the end of the method either the stream will be successfully opened, or an exception will have been thrown. <p> The parent directory will be created if it does not exist. The file will be cre...
openOutputStream
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
Apache-2.0
public static void saveCommandHistory(List<int[]> history, File file) { try (OutputStream out = new BufferedOutputStream(openOutputStream(file, false))) { for (int[] command : history) { String commandStr = Helper.fromCodePoints(command); if (isAuthCommand(commandStr)...
save the command history to the given file, data will be overridden. @param history the command history, each represented by an int array @param file the file to save the history
saveCommandHistory
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
Apache-2.0
public static List<int[]> loadCommandHistory(File file) { BufferedReader br = null; List<int[]> history = new ArrayList<>(); try { br = new BufferedReader(new InputStreamReader(new FileInputStream(file))); String line; while ((line = br.readLine()) != null) { ...
save the command history to the given file, data will be overridden. @param history the command history, each represented by an int array @param file the file to save the history
loadCommandHistory
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
Apache-2.0
public static void saveCommandHistoryString(List<String> history, File file) { try (OutputStream out = new BufferedOutputStream(openOutputStream(file, false))) { for (String command : history) { if (!StringUtils.isBlank(command)) { if (isAuthCommand(command)) { ...
save the command history to the given file, data will be overridden. @param history the command history @param file the file to save the history
saveCommandHistoryString
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
Apache-2.0
public static List<String> loadCommandHistoryString(File file) { BufferedReader br = null; List<String> history = new ArrayList<>(); try { br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "utf-8")); String line; while ((line = br.readLi...
save the command history to the given file, data will be overridden. @param history the command history @param file the file to save the history
loadCommandHistoryString
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
Apache-2.0
public static String readFileToString(File file, Charset encoding) throws IOException { try (FileInputStream stream = new FileInputStream(file)) { Reader reader = new BufferedReader(new InputStreamReader(stream, encoding)); StringBuilder builder = new StringBuilder(); char[] ...
save the command history to the given file, data will be overridden. @param history the command history @param file the file to save the history
readFileToString
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
Apache-2.0
public static Properties readProperties(String file) throws IOException { Properties properties = new Properties(); FileInputStream in = null; try { in = new FileInputStream(file); properties.load(in); return properties; } finally { com.ta...
save the command history to the given file, data will be overridden. @param history the command history @param file the file to save the history
readProperties
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
Apache-2.0
public static boolean isDirectoryOrNotExist(String path) { File file = new File(path); return !file.exists() || file.isDirectory(); }
Check if the given path is a directory or not exists. @param path path of file. @return {@code true} if the path is not exist or is an existing directory, otherwise returns {@code false}.
isDirectoryOrNotExist
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/FileUtils.java
Apache-2.0
public static String getCookieValue(Set<Cookie> cookies, String cookieName) { for (Cookie cookie : cookies) { if(cookie.name().equals(cookieName)){ return cookie.value(); } } return null; }
Get cookie value by name @param cookies request cookies @param cookieName the cookie name
getCookieValue
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/HttpUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/HttpUtils.java
Apache-2.0
public static void setCookie(DefaultFullHttpResponse response, String name, String value) { response.headers().add(HttpHeaderNames.SET_COOKIE, ServerCookieEncoder.STRICT.encode(name, value)); }
@param response @param name @param value
setCookie
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/HttpUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/HttpUtils.java
Apache-2.0
public static DefaultHttpResponse createResponse(FullHttpRequest request, HttpResponseStatus status, String content) { DefaultFullHttpResponse response = new DefaultFullHttpResponse(request.protocolVersion(), status); response.headers().set(HttpHeaderNames.CONTENT_TYPE, "text/html; charset=utf-8"); ...
Create http response with status code and content @param request request @param status response status code @param content response content
createResponse
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/HttpUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/HttpUtils.java
Apache-2.0
public static HttpResponse createRedirectResponse(FullHttpRequest request, String url) { DefaultFullHttpResponse response = new DefaultFullHttpResponse(request.protocolVersion(), HttpResponseStatus.FOUND); response.headers().set(HttpHeaderNames.LOCATION, url); return response; }
Create http response with status code and content @param request request @param status response status code @param content response content
createRedirectResponse
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/HttpUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/HttpUtils.java
Apache-2.0
public static byte[] toByteArray(InputStream input) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); copy(input, output); return output.toByteArray(); }
Get the contents of an <code>InputStream</code> as a <code>byte[]</code>. <p> This method buffers the input internally, so there is no need to use a <code>BufferedInputStream</code>. @param input the <code>InputStream</code> to read from @return the requested byte array @throws NullPointerException if the input is nu...
toByteArray
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/IOUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/IOUtils.java
Apache-2.0
public static int copy(InputStream input, OutputStream output) throws IOException { long count = copyLarge(input, output); if (count > Integer.MAX_VALUE) { return -1; } return (int) count; }
Copy bytes from an <code>InputStream</code> to an <code>OutputStream</code>. <p> This method buffers the input internally, so there is no need to use a <code>BufferedInputStream</code>. <p> Large streams (over 2GB) will return a bytes copied value of <code>-1</code> after the copy has completed since the correct number...
copy
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/IOUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/IOUtils.java
Apache-2.0
public static long copyLarge(InputStream input, OutputStream output) throws IOException { return copyLarge(input, output, new byte[DEFAULT_BUFFER_SIZE]); }
Copy bytes from a large (over 2GB) <code>InputStream</code> to an <code>OutputStream</code>. <p> This method buffers the input internally, so there is no need to use a <code>BufferedInputStream</code>. <p> The buffer size is given by {@link #DEFAULT_BUFFER_SIZE}. @param input the <code>InputStream</code> to read from...
copyLarge
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/IOUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/IOUtils.java
Apache-2.0
public static long copyLarge(InputStream input, OutputStream output, byte[] buffer) throws IOException { long count = 0; int n = 0; while (EOF != (n = input.read(buffer))) { output.write(buffer, 0, n); count += n; } return count; }
Copy bytes from a large (over 2GB) <code>InputStream</code> to an <code>OutputStream</code>. <p> This method uses the provided buffer, so there is no need to use a <code>BufferedInputStream</code>. <p> @param input the <code>InputStream</code> to read from @param output the <code>OutputStream</code> to write to @par...
copyLarge
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/IOUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/IOUtils.java
Apache-2.0
public static String toString(InputStream input) throws IOException { BufferedReader br = null; try { StringBuilder sb = new StringBuilder(); br = new BufferedReader(new InputStreamReader(input)); String line; while ((line = br.readLine()) != null) { ...
Get the contents of an <code>InputStream</code> as a String using the default character encoding of the platform. <p> This method buffers the input internally, so there is no need to use a <code>BufferedInputStream</code>. @param input the <code>InputStream</code> to read from @return the requested String @throws Nul...
toString
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/IOUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/IOUtils.java
Apache-2.0
public static boolean isWindowsOS() { String osName = System.getProperty(OS_NAME); return osName.toLowerCase().contains(WINDOWS); }
check: whether current operating system is windows @return true---is windows
isWindowsOS
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/IPUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/IPUtils.java
Apache-2.0
public static String simpleRequest(String url) { BufferedReader br = null; try { URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestProperty("Accept", "application/json"); int responseCode = con.getRespo...
@deprecated This implementation is based on HttpURLConnection, which can not detail with status code other than 200. @param url the requested url @return the response string of given url
simpleRequest
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/NetUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/NetUtils.java
Apache-2.0
public static Response requestViaSocket(String path) { BufferedReader br = null; try { Socket s = new Socket(QOS_HOST, QOS_PORT); PrintWriter pw = new PrintWriter(s.getOutputStream()); pw.println("GET " + path + " HTTP/1.1"); pw.println("Host: " + QOS_HOST...
Only use this method when tomcat monitor version <= 1.0.1 This will send http request to pandora qos port 12201, and display the response. Note that pandora qos response is not fully HTTP compatible under version 2.1.0, so we filtered some of the content and only display useful content. @param path the path relative to...
requestViaSocket
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/NetUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/NetUtils.java
Apache-2.0
public boolean isSuccess() { return success; }
Only use this method when tomcat monitor version <= 1.0.1 This will send http request to pandora qos port 12201, and display the response. Note that pandora qos response is not fully HTTP compatible under version 2.1.0, so we filtered some of the content and only display useful content. @param path the path relative to...
isSuccess
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/NetUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/NetUtils.java
Apache-2.0
public String getContent() { return content; }
Only use this method when tomcat monitor version <= 1.0.1 This will send http request to pandora qos port 12201, and display the response. Note that pandora qos response is not fully HTTP compatible under version 2.1.0, so we filtered some of the content and only display useful content. @param path the path relative to...
getContent
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/NetUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/NetUtils.java
Apache-2.0
public static boolean serverListening(String host, int port) { Socket s = null; try { s = new Socket(host, port); return true; } catch (Exception e) { return false; } finally { if (s != null) { try { s.cl...
Test if a port is open on the give host
serverListening
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/NetUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/NetUtils.java
Apache-2.0
public static boolean isBlank(final CharSequence cs) { int strLen; if (cs == null || (strLen = cs.length()) == 0) { return true; } for (int i = 0; i < strLen; i++) { if (!Character.isWhitespace(cs.charAt(i))) { return false; } }...
<p>Checks if a CharSequence is whitespace, empty ("") or null.</p> <pre> StringUtils.isBlank(null) = true StringUtils.isBlank("") = true StringUtils.isBlank(" ") = true StringUtils.isBlank("bob") = false StringUtils.isBlank(" bob ") = false </pre> @param cs the CharSequence to check, may be n...
isBlank
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
Apache-2.0
public static String repeat(final String str, final int repeat) { // Performance tuned for 2.0 (JDK1.4) if (str == null) { return null; } if (repeat <= 0) { return Constants.EMPTY_STRING; } final int inputLength = str.length(); if (repeat ...
<p>Repeat a String {@code repeat} times to form a new String.</p> <pre> StringUtils.repeat(null, 2) = null StringUtils.repeat("", 0) = "" StringUtils.repeat("", 2) = "" StringUtils.repeat("a", 3) = "aaa" StringUtils.repeat("ab", 2) = "abab" StringUtils.repeat("a", -2) = "" </pre> @param str the String to repeat...
repeat
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
Apache-2.0
public static int length(final CharSequence cs) { return cs == null ? 0 : cs.length(); }
Gets a CharSequence length or {@code 0} if the CharSequence is {@code null}. @param cs a CharSequence or {@code null} @return CharSequence length or {@code 0} if the CharSequence is {@code null}. @since 2.4 @since 3.0 Changed signature from length(String) to length(CharSequence)
length
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
Apache-2.0
public static String stripEnd(final String str, final String stripChars) { int end; if (str == null || (end = str.length()) == 0) { return str; } if (stripChars == null) { while (end != 0 && Character.isWhitespace(str.charAt(end - 1))) { end--; ...
<p>Strips any of a set of characters from the end of a String.</p> <p>A {@code null} input String returns {@code null}. An empty string ("") input returns the empty string.</p> <p>If the stripChars String is {@code null}, whitespace is stripped as defined by {@link Character#isWhitespace(char)}.</p> <pre> StringUtil...
stripEnd
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
Apache-2.0
public static String classLoaderHash(Class<?> clazz) { if (clazz == null || clazz.getClassLoader() == null) { return "null"; } return Integer.toHexString(clazz.getClassLoader().hashCode()); }
<p>Strips any of a set of characters from the end of a String.</p> <p>A {@code null} input String returns {@code null}. An empty string ("") input returns the empty string.</p> <p>If the stripChars String is {@code null}, whitespace is stripped as defined by {@link Character#isWhitespace(char)}.</p> <pre> StringUtil...
classLoaderHash
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
Apache-2.0
public static String humanReadableByteCount(long bytes) { return bytes < 1024L ? bytes + " B" : bytes < 0xfffccccccccccccL >> 40 ? String.format("%.1f KiB", bytes / 0x1p10) : bytes < 0xfffccccccccccccL >> 30 ? String.format("%.1f MiB", bytes / 0x1p20) : bytes < 0x...
format byte size to human readable format. https://stackoverflow.com/a/3758880 @param bytes byets @return human readable format
humanReadableByteCount
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
Apache-2.0
public static List<String> toLines(String text) { List<String> result = new ArrayList<String>(); BufferedReader reader = new BufferedReader(new StringReader(text)); try { String line = reader.readLine(); while (line != null) { result.add(line); ...
format byte size to human readable format. https://stackoverflow.com/a/3758880 @param bytes byets @return human readable format
toLines
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
Apache-2.0
public static String randomString(int length) { StringBuilder sb = new StringBuilder(length); for (int i = 0; i < length; i++) sb.append(AB.charAt(ThreadLocalRandom.current().nextInt(AB.length()))); return sb.toString(); }
format byte size to human readable format. https://stackoverflow.com/a/3758880 @param bytes byets @return human readable format
randomString
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
Apache-2.0
public static String before(String text, String before) { int pos = text.indexOf(before); return pos == -1 ? null : text.substring(0, pos); }
Returns the string before the given token @param text the text @param before the token @return the text before the token, or <tt>null</tt> if text does not contain the token
before
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
Apache-2.0
public static String after(String text, String after) { int pos = text.indexOf(after); if (pos == -1) { return null; } return text.substring(pos + after.length()); }
Returns the string after the given token @param text the text @param after the token @return the text after the token, or <tt>null</tt> if text does not contain the token
after
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
Apache-2.0
public static String[] splitMethodInfo(String methodInfo) { int index = methodInfo.indexOf('|'); return new String[] { methodInfo.substring(0, index), methodInfo.substring(index + 1) }; }
Returns the string after the given token @param text the text @param after the token @return the text after the token, or <tt>null</tt> if text does not contain the token
splitMethodInfo
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
Apache-2.0
public static String[] splitInvokeInfo(String invokeInfo) { int index1 = invokeInfo.indexOf('|'); int index2 = invokeInfo.indexOf('|', index1 + 1); int index3 = invokeInfo.indexOf('|', index2 + 1); return new String[] { invokeInfo.substring(0, index1), invokeInfo.substring(index1 + 1, in...
Returns the string after the given token @param text the text @param after the token @return the text after the token, or <tt>null</tt> if text does not contain the token
splitInvokeInfo
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
Apache-2.0
public static String beautifyName(String name) { return name.replace(' ', '_').toLowerCase(); }
Returns the string after the given token @param text the text @param after the token @return the text after the token, or <tt>null</tt> if text does not contain the token
beautifyName
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
Apache-2.0
public static List<String> toStringList(URL[] urls) { if (urls != null) { List<String> result = new ArrayList<String>(urls.length); for (URL url : urls) { result.add(url.toString()); } return result; } return Collections.emptyList()...
Returns the string after the given token @param text the text @param after the token @return the text after the token, or <tt>null</tt> if text does not contain the token
toStringList
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/StringUtils.java
Apache-2.0
public static BlockingLockInfo findMostBlockingLock() { ThreadInfo[] infos = threadMXBean.dumpAllThreads(threadMXBean.isObjectMonitorUsageSupported(), threadMXBean.isSynchronizerUsageSupported()); // a map of <LockInfo.getIdentityHashCode, number of thread blocking on this> Map<...
Find the thread and lock that is blocking the most other threads. Time complexity of this algorithm: O(number of thread) Space complexity of this algorithm: O(number of locks) @return the BlockingLockInfo object, or an empty object if not found.
findMostBlockingLock
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/ThreadUtil.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/ThreadUtil.java
Apache-2.0
public static String getFullStacktrace(ThreadInfo threadInfo) { return getFullStacktrace(threadInfo, -1, -1, -1, 0, 0); }
Find the thread and lock that is blocking the most other threads. Time complexity of this algorithm: O(number of thread) Space complexity of this algorithm: O(number of locks) @return the BlockingLockInfo object, or an empty object if not found.
getFullStacktrace
java
alibaba/arthas
core/src/main/java/com/taobao/arthas/core/util/ThreadUtil.java
https://github.com/alibaba/arthas/blob/master/core/src/main/java/com/taobao/arthas/core/util/ThreadUtil.java
Apache-2.0