You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2023/06/27 22:14:59 UTC
[accumulo] branch elasticity updated: use LazySingletons.GSON in SelectedFiles
This is an automated email from the ASF dual-hosted git repository.
kturner pushed a commit to branch elasticity
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/elasticity by this push:
new 0c29192359 use LazySingletons.GSON in SelectedFiles
0c29192359 is described below
commit 0c29192359a2df85290d4c660e8290c0f0caca30
Author: Keith Turner <kt...@apache.org>
AuthorDate: Tue Jun 27 18:14:49 2023 -0400
use LazySingletons.GSON in SelectedFiles
---
.../org/apache/accumulo/core/metadata/schema/SelectedFiles.java | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/schema/SelectedFiles.java b/core/src/main/java/org/apache/accumulo/core/metadata/schema/SelectedFiles.java
index a83714b76b..e0863f53ba 100644
--- a/core/src/main/java/org/apache/accumulo/core/metadata/schema/SelectedFiles.java
+++ b/core/src/main/java/org/apache/accumulo/core/metadata/schema/SelectedFiles.java
@@ -19,6 +19,7 @@
package org.apache.accumulo.core.metadata.schema;
import static java.util.stream.Collectors.toList;
+import static org.apache.accumulo.core.util.LazySingletons.GSON;
import java.util.List;
import java.util.Set;
@@ -28,15 +29,12 @@ import org.apache.accumulo.core.fate.FateTxId;
import org.apache.accumulo.core.metadata.StoredTabletFile;
import com.google.common.base.Preconditions;
-import com.google.gson.Gson;
/**
* This class is used to manage the set of files selected for a user compaction for a tablet.
*/
public class SelectedFiles {
- private static final Gson GSON = new Gson();
-
private final Set<StoredTabletFile> files;
private final boolean initiallySelectedAll;
@@ -65,7 +63,7 @@ public class SelectedFiles {
jData.selAll = initiallySelectedAll;
// ELASITICITY_TODO need the produced json to always be the same when the input data is the same
// as its used for comparison. Need unit test to ensure this behavior.
- metadataValue = GSON.toJson(jData);
+ metadataValue = GSON.get().toJson(jData);
}
private SelectedFiles(Set<StoredTabletFile> files, boolean initiallySelectedAll, long fateTxId,
@@ -78,7 +76,7 @@ public class SelectedFiles {
}
public static SelectedFiles from(String json) {
- GSonData jData = GSON.fromJson(json, GSonData.class);
+ GSonData jData = GSON.get().fromJson(json, GSonData.class);
return new SelectedFiles(
jData.files.stream().map(StoredTabletFile::new).collect(Collectors.toSet()), jData.selAll,
FateTxId.fromString(jData.txid), json);