diff --git a/src/main/java/io/cryostat/targets/TargetJvmIdUpdateJob.java b/src/main/java/io/cryostat/targets/TargetJvmIdUpdateJob.java index 0bac9462c..e28bb2e53 100644 --- a/src/main/java/io/cryostat/targets/TargetJvmIdUpdateJob.java +++ b/src/main/java/io/cryostat/targets/TargetJvmIdUpdateJob.java @@ -63,8 +63,8 @@ private void updateTargetJvmId(long id) { QuarkusTransaction.requiringNew() .run( () -> { + Target target = Target.getTargetById(id); try { - Target target = Target.getTargetById(id); target.jvmId = connectionManager .executeDirect( @@ -74,10 +74,11 @@ private void updateTargetJvmId(long id) { .map(JvmIdentifier::getHash) .await() .atMost(connectionTimeout); - target.persist(); } catch (Exception e) { + target.jvmId = null; logger.error(e); } + target.persist(); }); } }