From 9d44862f6e980d99b23dc6561163b6aa42c7b93d Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:31:10 -0500 Subject: [PATCH] build(deps): bump io.cryostat:cryostat-core from 2.24.0 to 2.25.0 (#1808) (#1811) * build(deps): bump io.cryostat:cryostat-core from 2.24.0 to 2.25.0 Bumps [io.cryostat:cryostat-core](https://github.com/cryostatio/cryostat-core) from 2.24.0 to 2.25.0. - [Release notes](https://github.com/cryostatio/cryostat-core/releases) - [Commits](https://github.com/cryostatio/cryostat-core/compare/v2.24.0...v2.25.0) --- updated-dependencies: - dependency-name: io.cryostat:cryostat-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * implement new interface method * cleanup --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Andrew Azores (cherry picked from commit f7b16a611133d304b149be47a6e61183508d4b05) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- .../java/io/cryostat/net/AgentConnection.java | 32 ++++++------------- .../java/io/cryostat/net/NetworkModule.java | 9 ++---- 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/pom.xml b/pom.xml index 7521aa9d53..b7f99bcec7 100644 --- a/pom.xml +++ b/pom.xml @@ -85,7 +85,7 @@ 2.47 ${com.google.dagger.version} - 2.24.0 + 2.25.0 15.4 3.13.0 diff --git a/src/main/java/io/cryostat/net/AgentConnection.java b/src/main/java/io/cryostat/net/AgentConnection.java index f1538f0d05..263297b139 100644 --- a/src/main/java/io/cryostat/net/AgentConnection.java +++ b/src/main/java/io/cryostat/net/AgentConnection.java @@ -29,6 +29,7 @@ import org.openjdk.jmc.rjmx.IConnectionHandle; import org.openjdk.jmc.rjmx.ServiceNotAvailableException; +import io.cryostat.core.JvmIdentifier; import io.cryostat.core.log.Logger; import io.cryostat.core.net.CryostatFlightRecorderService; import io.cryostat.core.net.IDException; @@ -39,26 +40,18 @@ import io.cryostat.core.sys.FileSystem; import io.cryostat.core.templates.MergedTemplateService; import io.cryostat.core.templates.TemplateService; -import io.cryostat.recordings.JvmIdHelper; import org.apache.commons.lang3.exception.ExceptionUtils; public class AgentConnection implements JFRConnection { private final AgentClient client; - private final JvmIdHelper idHelper; private final FileSystem fs; private final Environment env; private final Logger logger; - AgentConnection( - AgentClient client, - JvmIdHelper idHelper, - FileSystem fs, - Environment env, - Logger logger) { + AgentConnection(AgentClient client, FileSystem fs, Environment env, Logger logger) { this.client = client; - this.idHelper = idHelper; this.fs = fs; this.env = env; this.logger = logger; @@ -111,10 +104,12 @@ public JMXServiceURL getJMXURL() throws IOException { } @Override - public String getJvmId() throws IDException, IOException { - // this should have already been populated when the agent published itself to the Discovery - // API. If not, then this will fail, but we were in a bad state to begin with. - return idHelper.getJvmId(getUri().toString()); + public JvmIdentifier getJvmIdentifier() throws IDException, IOException { + try { + return JvmIdentifier.from(getMBeanMetrics().getRuntime()); + } catch (IntrospectionException | InstanceNotFoundException | ReflectionException e) { + throw new IDException(e); + } } @Override @@ -154,26 +149,19 @@ public MBeanMetrics getMBeanMetrics() public static class Factory { private final AgentClient.Factory clientFactory; - private final JvmIdHelper idHelper; private final FileSystem fs; private final Environment env; private final Logger logger; - Factory( - AgentClient.Factory clientFactory, - JvmIdHelper idHelper, - FileSystem fs, - Environment env, - Logger logger) { + Factory(AgentClient.Factory clientFactory, FileSystem fs, Environment env, Logger logger) { this.clientFactory = clientFactory; - this.idHelper = idHelper; this.fs = fs; this.env = env; this.logger = logger; } AgentConnection createConnection(URI agentUri) { - return new AgentConnection(clientFactory.create(agentUri), idHelper, fs, env, logger); + return new AgentConnection(clientFactory.create(agentUri), fs, env, logger); } } } diff --git a/src/main/java/io/cryostat/net/NetworkModule.java b/src/main/java/io/cryostat/net/NetworkModule.java index 765d387e0c..6218fa3db9 100644 --- a/src/main/java/io/cryostat/net/NetworkModule.java +++ b/src/main/java/io/cryostat/net/NetworkModule.java @@ -38,7 +38,6 @@ import io.cryostat.net.security.SecurityModule; import io.cryostat.net.web.WebModule; import io.cryostat.net.web.http.HttpModule; -import io.cryostat.recordings.JvmIdHelper; import com.github.benmanes.caffeine.cache.Scheduler; import com.google.gson.Gson; @@ -97,12 +96,8 @@ static Duration provideMaxTargetTTL(Environment env) { @Provides @Singleton static AgentConnection.Factory provideAgentConnectionFactory( - AgentClient.Factory clientFactory, - JvmIdHelper idHelper, - FileSystem fs, - Environment env, - Logger logger) { - return new AgentConnection.Factory(clientFactory, idHelper, fs, env, logger); + AgentClient.Factory clientFactory, FileSystem fs, Environment env, Logger logger) { + return new AgentConnection.Factory(clientFactory, fs, env, logger); } @Provides