milleruntime commented on code in PR #2718:
URL: https://github.com/apache/accumulo/pull/2718#discussion_r881650728
##########
core/src/main/java/org/apache/accumulo/core/metadata/schema/RootGcCandidatesJson.java:
##########
@@ -96,20 +98,6 @@ public Stream<String> stream() {
}
public String toJson() {
- GSonData gd = new GSonData();
- gd.candidates = candidates;
- return GSON.toJson(gd);
- }
-
- public static RootGcCandidates fromJson(String json) {
- GSonData gd = GSON.fromJson(json, GSonData.class);
-
- Preconditions.checkArgument(gd.version == 1);
-
- return new RootGcCandidates(gd.candidates);
- }
-
- public static RootGcCandidates fromJson(byte[] json) {
- return fromJson(new String(json, UTF_8));
+ return GSON.toJson(this);
Review Comment:
Nvm, this is not a static method anymore. This is a method on the object
itselft so it just returns itself, serialized to a JSON string. It is used in a
couple spots:
During Initialize:
<pre>
zoo.putPersistentData(zkInstanceRoot + RootTable.ZROOT_TABLET_GC_CANDIDATES,
new RootGcCandidatesJson().toJson().getBytes(UTF_8),
ZooUtil.NodeExistsPolicy.FAIL);
</pre>
In Ample:
<pre>
RootGcCandidatesJson rgcc = new RootGcCandidatesJson(currJson);
log.debug("Root GC candidates before change : {}", currJson);
mutator.accept(rgcc);
String newJson = rgcc.toJson();
log.debug("Root GC candidates after change : {}", newJson);
</pre>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]