Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Azores <aazores@redhat.com>
  • Loading branch information
andrewazores committed Mar 15, 2023
1 parent ac50f33 commit 296c940
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 4 additions & 6 deletions src/main/java/io/cryostat/net/AgentClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,9 @@ Future<MBeanMetrics> mbeanMetrics() {
Future<HttpResponse<String>> f =
invoke(HttpMethod.GET, "/mbean-metrics", BodyCodec.string());
return f.map(HttpResponse::body)
.map(
s -> {
logger.info("mbean response: {}", s);
return gson.fromJson(s, MBeanMetrics.class);
});
// uses Gson rather than Vertx's Jackson because Gson is able to handle MBeanMetrics
// with no additional fuss. Jackson complains about private final fields.
.map(s -> gson.fromJson(s, MBeanMetrics.class));
}

private <T> Future<HttpResponse<T>> invoke(HttpMethod mtd, String path, BodyCodec<T> codec) {
Expand Down Expand Up @@ -143,7 +141,7 @@ private <T> Future<HttpResponse<T>> invoke(HttpMethod mtd, String path, BodyCode
promise.fail(ar.cause());
return;
}
logger.info(
logger.trace(
"{} {}{} status {}: {}",
mtd,
agentUri,
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/io/cryostat/net/AgentConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,7 @@ public MBeanMetrics getMBeanMetrics()
throws ConnectionException, IOException, InstanceNotFoundException,
IntrospectionException, ReflectionException {
try {
var m = client.mbeanMetrics().toCompletionStage().toCompletableFuture().get();
logger.info("mbeans: {}", m);
return m;
return client.mbeanMetrics().toCompletionStage().toCompletableFuture().get();
} catch (ExecutionException | InterruptedException e) {
throw new IOException(e);
}
Expand Down

0 comments on commit 296c940

Please sign in to comment.