From 558ef095402fddee9c741d964e453a6d1a134822 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 00:23:09 +0000 Subject: [PATCH 1/2] build(deps): bump io.cryostat:cryostat-core from 2.29.1 to 2.30.0 Bumps [io.cryostat:cryostat-core](https://github.com/cryostatio/cryostat-core) from 2.29.1 to 2.30.0. - [Release notes](https://github.com/cryostatio/cryostat-core/releases) - [Commits](https://github.com/cryostatio/cryostat-core/compare/v2.29.1...v2.30.0) --- updated-dependencies: - dependency-name: io.cryostat:cryostat-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5cc3d49fc9..c01dfa00a3 100644 --- a/pom.xml +++ b/pom.xml @@ -78,7 +78,7 @@ 2.47 ${com.google.dagger.version} - 2.29.1 + 2.30.0 15.4 3.13.0 From 2f9b74c097f230550099d1ec1e8789aff5f02d36 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Fri, 1 Mar 2024 11:09:46 -0500 Subject: [PATCH 2/2] remove MemoryUsageTypeAdapter --- src/main/java/io/cryostat/MainModule.java | 5 +- .../cryostat/util/MemoryUsageTypeAdapter.java | 66 ------------------- 2 files changed, 1 insertion(+), 70 deletions(-) delete mode 100644 src/main/java/io/cryostat/util/MemoryUsageTypeAdapter.java diff --git a/src/main/java/io/cryostat/MainModule.java b/src/main/java/io/cryostat/MainModule.java index 14cbf392e6..7e4724e3d8 100644 --- a/src/main/java/io/cryostat/MainModule.java +++ b/src/main/java/io/cryostat/MainModule.java @@ -15,7 +15,6 @@ */ package io.cryostat; -import java.lang.management.MemoryUsage; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Set; @@ -46,7 +45,6 @@ import io.cryostat.templates.TemplatesModule; import io.cryostat.util.GsonJmxServiceUrlAdapter; import io.cryostat.util.HttpMimeTypeAdapter; -import io.cryostat.util.MemoryUsageTypeAdapter; import io.cryostat.util.PathTypeAdapter; import io.cryostat.util.PluggableJsonDeserializer; import io.cryostat.util.PluggableTypeAdapter; @@ -133,8 +131,7 @@ public static Gson provideGson( .registerTypeAdapter(HttpMimeType.class, new HttpMimeTypeAdapter()) .registerTypeHierarchyAdapter(Path.class, new PathTypeAdapter()) .registerTypeAdapter(Rule.class, new RuleDeserializer()) - .registerTypeAdapter(ProbeTemplate.class, new ProbeTemplateTypeAdapter()) - .registerTypeAdapter(MemoryUsage.class, new MemoryUsageTypeAdapter()); + .registerTypeAdapter(ProbeTemplate.class, new ProbeTemplateTypeAdapter()); for (PluggableTypeAdapter pta : extraAdapters) { builder = builder.registerTypeAdapter(pta.getAdaptedType(), pta); } diff --git a/src/main/java/io/cryostat/util/MemoryUsageTypeAdapter.java b/src/main/java/io/cryostat/util/MemoryUsageTypeAdapter.java deleted file mode 100644 index f4b70c511f..0000000000 --- a/src/main/java/io/cryostat/util/MemoryUsageTypeAdapter.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright The Cryostat Authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.cryostat.util; - -import java.io.IOException; -import java.lang.management.MemoryUsage; - -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; - -public class MemoryUsageTypeAdapter extends TypeAdapter { - - @Override - public MemoryUsage read(JsonReader reader) throws IOException { - long init = -1; - long used = 0; - long committed = 0; - long max = -1; - reader.beginObject(); - while (reader.hasNext()) { - String nextName = reader.nextName(); - switch (nextName) { - case "init": - init = reader.nextLong(); - break; - case "used": - used = reader.nextLong(); - break; - case "committed": - committed = reader.nextLong(); - break; - case "max": - max = reader.nextLong(); - break; - default: - throw new IOException("Unexpected memory usage field: " + nextName); - } - } - reader.endObject(); - return new MemoryUsage(init, used, committed, max); - } - - @Override - public void write(JsonWriter writer, MemoryUsage mu) throws IOException { - writer.beginObject(); - writer.name("init").value(mu.getInit()); - writer.name("used").value(mu.getUsed()); - writer.name("committed").value(mu.getCommitted()); - writer.name("max").value(mu.getMax()); - writer.endObject(); - } -}