Exemplo n.º 1
0
 private void gc() throws Exception {
   sendRequest(
       ServerRequest.newBuilder()
           .setRequestId(nextRequestId.getAndIncrement())
           .setGcRequest(GcRequest.getDefaultInstance())
           .build());
 }
Exemplo n.º 2
0
 private void preloadClasspathCache() throws Exception {
   sendRequest(
       ServerRequest.newBuilder()
           .setRequestId(nextRequestId.getAndIncrement())
           .setPreloadClasspathCacheRequest(PreloadClasspathCacheRequest.getDefaultInstance())
           .build());
 }
Exemplo n.º 3
0
 private void updateAgentConfig(AgentConfig agentConfig) throws Exception {
   sendRequest(
       ServerRequest.newBuilder()
           .setRequestId(nextRequestId.getAndIncrement())
           .setAgentConfigUpdateRequest(
               AgentConfigUpdateRequest.newBuilder().setAgentConfig(agentConfig))
           .build());
 }
Exemplo n.º 4
0
 private List<Trace.Entry> getEntries(String traceId) throws Exception {
   ClientResponse response =
       sendRequest(
           ServerRequest.newBuilder()
               .setRequestId(nextRequestId.getAndIncrement())
               .setEntriesRequest(EntriesRequest.newBuilder().setTraceId(traceId))
               .build());
   return response.getEntriesResponse().getEntryList();
 }
Exemplo n.º 5
0
 private int reweave() throws Exception {
   ClientResponse response =
       sendRequest(
           ServerRequest.newBuilder()
               .setRequestId(nextRequestId.getAndIncrement())
               .setReweaveRequest(ReweaveRequest.getDefaultInstance())
               .build());
   return response.getReweaveResponse().getClassUpdateCount();
 }
Exemplo n.º 6
0
 private GlobalMeta globalMeta() throws Exception {
   ClientResponse response =
       sendRequest(
           ServerRequest.newBuilder()
               .setRequestId(nextRequestId.getAndIncrement())
               .setGlobalMetaRequest(GlobalMetaRequest.getDefaultInstance())
               .build());
   return response.getGlobalMetaResponse().getGlobalMeta();
 }
Exemplo n.º 7
0
 private Capabilities capabilities() throws Exception {
   ClientResponse response =
       sendRequest(
           ServerRequest.newBuilder()
               .setRequestId(nextRequestId.getAndIncrement())
               .setCapabilitiesRequest(CapabilitiesRequest.getDefaultInstance())
               .build());
   return response.getCapabilitiesResponse().getCapabilities();
 }
Exemplo n.º 8
0
 private MBeanMeta mbeanMeta(String objectName) throws Exception {
   ClientResponse response =
       sendRequest(
           ServerRequest.newBuilder()
               .setRequestId(nextRequestId.getAndIncrement())
               .setMbeanMetaRequest(MBeanMetaRequest.newBuilder().setObjectName(objectName))
               .build());
   return response.getMbeanMetaResponse().getMbeanMeta();
 }
Exemplo n.º 9
0
 private HeapDumpFileInfo heapDump(String directory) throws Exception {
   ClientResponse response =
       sendRequest(
           ServerRequest.newBuilder()
               .setRequestId(nextRequestId.getAndIncrement())
               .setHeapDumpRequest(HeapDumpRequest.newBuilder().setDirectory(directory))
               .build());
   return response.getHeapDumpResponse().getHeapDumpFileInfo();
 }
Exemplo n.º 10
0
 private ThreadDump threadDump() throws Exception {
   ClientResponse response =
       sendRequest(
           ServerRequest.newBuilder()
               .setRequestId(nextRequestId.getAndIncrement())
               .setThreadDumpRequest(ThreadDumpRequest.getDefaultInstance())
               .build());
   return response.getThreadDumpResponse().getThreadDump();
 }
Exemplo n.º 11
0
 private long availableDiskSpaceBytes(String directory) throws Exception {
   ClientResponse response =
       sendRequest(
           ServerRequest.newBuilder()
               .setRequestId(nextRequestId.getAndIncrement())
               .setAvailableDiskSpaceRequest(
                   AvailableDiskSpaceRequest.newBuilder().setDirectory(directory))
               .build());
   return response.getAvailableDiskSpaceResponse().getAvailableBytes();
 }
Exemplo n.º 12
0
 private List<String> matchingClassNames(String partialClassName, int limit) throws Exception {
   ClientResponse response =
       sendRequest(
           ServerRequest.newBuilder()
               .setRequestId(nextRequestId.getAndIncrement())
               .setMatchingClassNamesRequest(
                   MatchingClassNamesRequest.newBuilder()
                       .setPartialClassName(partialClassName)
                       .setLimit(limit))
               .build());
   return response.getMatchingClassNamesResponse().getClassNameList();
 }
Exemplo n.º 13
0
 private @Nullable Trace getFullTrace(String traceId) throws Exception {
   ClientResponse response =
       sendRequest(
           ServerRequest.newBuilder()
               .setRequestId(nextRequestId.getAndIncrement())
               .setFullTraceRequest(FullTraceRequest.newBuilder().setTraceId(traceId))
               .build());
   if (response.getFullTraceResponse().hasTrace()) {
     return response.getFullTraceResponse().getTrace();
   } else {
     return null;
   }
 }
Exemplo n.º 14
0
 private List<MethodSignature> methodSignatures(String className, String methodName)
     throws Exception {
   ClientResponse response =
       sendRequest(
           ServerRequest.newBuilder()
               .setRequestId(nextRequestId.getAndIncrement())
               .setMethodSignaturesRequest(
                   MethodSignaturesRequest.newBuilder()
                       .setClassName(className)
                       .setMethodName(methodName))
               .build());
   return response.getMethodSignaturesResponse().getMethodSignatureList();
 }
Exemplo n.º 15
0
 private MBeanDump mbeanDump(MBeanDumpKind mbeanDumpKind, List<String> objectNames)
     throws Exception {
   ClientResponse response =
       sendRequest(
           ServerRequest.newBuilder()
               .setRequestId(nextRequestId.getAndIncrement())
               .setMbeanDumpRequest(
                   MBeanDumpRequest.newBuilder()
                       .setKind(mbeanDumpKind)
                       .addAllObjectName(objectNames))
               .build());
   return response.getMbeanDumpResponse().getMbeanDump();
 }
Exemplo n.º 16
0
 @Override
 public void onNext(ClientResponse value) {
   if (value.getMessageCase() == MessageCase.HELLO) {
     agentId = value.getHello().getAgentId();
     connectedAgents.put(agentId, ConnectedAgent.this);
     requestObserver.onNext(
         ServerRequest.newBuilder().setHelloAck(HelloAck.getDefaultInstance()).build());
     return;
   }
   long requestId = value.getRequestId();
   ResponseHolder responseHolder = responseHolders.getIfPresent(requestId);
   responseHolders.invalidate(requestId);
   if (responseHolder == null) {
     logger.error("no response holder for request id: {}", requestId);
     return;
   }
   try {
     responseHolder.response.exchange(value);
   } catch (InterruptedException e) {
     Thread.currentThread().interrupt();
     logger.error(e.getMessage(), e);
   }
 }