diff --git a/pom.xml b/pom.xml
index 8a9531373b..c9cabdd470 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