From 59e641a009eab77906f5cee52fe09159c584cea2 Mon Sep 17 00:00:00 2001 From: Fizell <943379410@qq.com> Date: Mon, 25 Apr 2022 22:27:56 +0800 Subject: [PATCH] fix hugegraph-api code checkstyle --- .../java/com/baidu/hugegraph/api/API.java | 20 ++++++++++--------- .../baidu/hugegraph/api/auth/ProjectAPI.java | 3 ++- .../baidu/hugegraph/api/graph/BatchAPI.java | 14 ++++++------- .../hugegraph/api/gremlin/GremlinAPI.java | 14 ++++++------- .../baidu/hugegraph/api/job/GremlinAPI.java | 4 ++-- .../hugegraph/api/schema/IndexLabelAPI.java | 4 ++-- .../hugegraph/auth/HugeAuthenticator.java | 1 + .../hugegraph/auth/HugeFactoryAuthProxy.java | 20 +++++++++---------- .../hugegraph/auth/HugeGraphAuthProxy.java | 11 +++++----- .../hugegraph/license/LicenseVerifier.java | 2 +- .../baidu/hugegraph/metrics/MetricsUtil.java | 12 +++++------ .../hugegraph/server/ApplicationConfig.java | 8 ++++---- 12 files changed, 58 insertions(+), 55 deletions(-) diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/API.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/API.java index 8aabf505bb..352c4e87f3 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/API.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/API.java @@ -59,13 +59,13 @@ public class API { public static final String ACTION_ELIMINATE = "eliminate"; public static final String ACTION_CLEAR = "clear"; - private static final Meter succeedMeter = + private static final Meter SUCCEED_METER = MetricsUtil.registerMeter(API.class, "commit-succeed"); - private static final Meter illegalArgErrorMeter = + private static final Meter ILLEGAL_ARG_ERROR_METER = MetricsUtil.registerMeter(API.class, "illegal-arg"); - private static final Meter expectedErrorMeter = + private static final Meter EXPECTED_ERROR_METER = MetricsUtil.registerMeter(API.class, "expected-error"); - private static final Meter unknownErrorMeter = + private static final Meter UNKNOWN_ERROR_METER = MetricsUtil.registerMeter(API.class, "unknown-error"); public static HugeGraph graph(GraphManager manager, String graph) { @@ -96,19 +96,19 @@ public static R commit(HugeGraph g, Callable callable) { try { R result = callable.call(); g.tx().commit(); - succeedMeter.mark(); + SUCCEED_METER.mark(); return result; } catch (IllegalArgumentException | NotFoundException | ForbiddenException e) { - illegalArgErrorMeter.mark(); + ILLEGAL_ARG_ERROR_METER.mark(); rollback.accept(null); throw e; } catch (RuntimeException e) { - expectedErrorMeter.mark(); + EXPECTED_ERROR_METER.mark(); rollback.accept(e); throw e; } catch (Throwable e) { - unknownErrorMeter.mark(); + UNKNOWN_ERROR_METER.mark(); rollback.accept(e); // TODO: throw the origin exception 'e' throw new HugeException("Failed to commit", e); @@ -171,7 +171,9 @@ protected static Map parseProperties(String properties) { Map props = null; try { props = JsonUtil.fromJson(properties, Map.class); - } catch (Exception ignored) {} + } catch (Exception ignored) { + // ignore + } // If properties is the string "null", props will be null E.checkArgument(props != null, diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java index e91b4f4309..5effd732bd 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java @@ -176,6 +176,7 @@ public void delete(@Context GraphManager manager, throw new IllegalArgumentException("Invalid project id: " + id); } } + public static boolean isAddGraph(String action) { return ACTION_ADD_GRAPH.equals(action); } @@ -267,6 +268,6 @@ public void checkUpdate() { this.description != null, "Must specify 'graphs' or 'description' " + "field that need to be updated"); - } } + } } diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/graph/BatchAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/graph/BatchAPI.java index ebc54be66e..515b1ca6b4 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/graph/BatchAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/graph/BatchAPI.java @@ -47,11 +47,11 @@ public class BatchAPI extends API { private static final Logger LOG = Log.logger(BatchAPI.class); // NOTE: VertexAPI and EdgeAPI should share a counter - private static final AtomicInteger batchWriteThreads = new AtomicInteger(0); + private static final AtomicInteger BATCH_WRITE_THREADS = new AtomicInteger(0); static { MetricsUtil.registerGauge(RestServer.class, "batch-write-threads", - () -> batchWriteThreads.intValue()); + () -> BATCH_WRITE_THREADS.intValue()); } private final Meter batchMeter; @@ -64,24 +64,24 @@ public BatchAPI() { public R commit(HugeConfig config, HugeGraph g, int size, Callable callable) { int maxWriteThreads = config.get(ServerOptions.MAX_WRITE_THREADS); - int writingThreads = batchWriteThreads.incrementAndGet(); + int writingThreads = BATCH_WRITE_THREADS.incrementAndGet(); if (writingThreads > maxWriteThreads) { - batchWriteThreads.decrementAndGet(); + BATCH_WRITE_THREADS.decrementAndGet(); throw new HugeException("The rest server is too busy to write"); } - LOG.debug("The batch writing threads is {}", batchWriteThreads); + LOG.debug("The batch writing threads is {}", BATCH_WRITE_THREADS); try { R result = commit(g, callable); this.batchMeter.mark(size); return result; } finally { - batchWriteThreads.decrementAndGet(); + BATCH_WRITE_THREADS.decrementAndGet(); } } @JsonIgnoreProperties(value = {"type"}) - protected static abstract class JsonElement implements Checkable { + protected abstract static class JsonElement implements Checkable { @JsonProperty("id") public Object id; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinAPI.java index 5c897cb730..60fc5c9b19 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinAPI.java @@ -51,9 +51,9 @@ @Singleton public class GremlinAPI extends API { - private static final Histogram gremlinInputHistogram = + private static final Histogram GREMLIN_INPUT_HISTOGRAM = MetricsUtil.registerHistogram(GremlinAPI.class, "gremlin-input"); - private static final Histogram gremlinOutputHistogram = + private static final Histogram GREMLIN_OUTPUT_HISTOGRAM = MetricsUtil.registerHistogram(GremlinAPI.class, "gremlin-output"); private static final Set FORBIDDEN_REQUEST_EXCEPTIONS = @@ -100,14 +100,14 @@ public Response post(@Context HugeConfig conf, // .build(); String auth = headers.getHeaderString(HttpHeaders.AUTHORIZATION); Response response = this.client().doPostRequest(auth, request); - gremlinInputHistogram.update(request.length()); - gremlinOutputHistogram.update(response.getLength()); + GREMLIN_INPUT_HISTOGRAM.update(request.length()); + GREMLIN_OUTPUT_HISTOGRAM.update(response.getLength()); return transformResponseIfNeeded(response); } @GET @Timed - @Compress(buffer=(1024 * 40)) + @Compress(buffer = (1024 * 40)) @Produces(APPLICATION_JSON_WITH_CHARSET) public Response get(@Context HugeConfig conf, @Context HttpHeaders headers, @@ -116,8 +116,8 @@ public Response get(@Context HugeConfig conf, String query = uriInfo.getRequestUri().getRawQuery(); MultivaluedMap params = uriInfo.getQueryParameters(); Response response = this.client().doGetRequest(auth, params); - gremlinInputHistogram.update(query.length()); - gremlinOutputHistogram.update(response.getLength()); + GREMLIN_INPUT_HISTOGRAM.update(query.length()); + GREMLIN_OUTPUT_HISTOGRAM.update(response.getLength()); return transformResponseIfNeeded(response); } diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/GremlinAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/GremlinAPI.java index 9d1a5a2151..8a0c865937 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/GremlinAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/GremlinAPI.java @@ -65,7 +65,7 @@ public class GremlinAPI extends API { private static final int MAX_NAME_LENGTH = 256; - private static final Histogram gremlinJobInputHistogram = + private static final Histogram GREMLIN_JOB_INPUT_HISTOGRAM = MetricsUtil.registerHistogram(GremlinAPI.class, "gremlin-input"); @POST @@ -79,7 +79,7 @@ public Map post(@Context GraphManager manager, GremlinRequest request) { LOG.debug("Graph [{}] schedule gremlin job: {}", graph, request); checkCreatingBody(request); - gremlinJobInputHistogram.update(request.gremlin.length()); + GREMLIN_JOB_INPUT_HISTOGRAM.update(request.gremlin.length()); HugeGraph g = graph(manager, graph); request.aliase(graph, "graph"); diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/IndexLabelAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/IndexLabelAPI.java index b98e8b9bd6..08c4b55830 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/IndexLabelAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/schema/IndexLabelAPI.java @@ -104,8 +104,8 @@ public String update(@Context GraphManager manager, HugeGraph g = graph(manager, graph); IndexLabel.Builder builder = jsonIndexLabel.convert2Builder(g); - IndexLabel IndexLabel = append ? builder.append() : builder.eliminate(); - return manager.serializer(g).writeIndexlabel(mapIndexLabel(IndexLabel)); + IndexLabel indexLabel = append ? builder.append() : builder.eliminate(); + return manager.serializer(g).writeIndexlabel(mapIndexLabel(indexLabel)); } @GET diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeAuthenticator.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeAuthenticator.java index 362bb95bf2..b6369b3552 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeAuthenticator.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeAuthenticator.java @@ -68,6 +68,7 @@ public interface HugeAuthenticator extends Authenticator { public UserWithRole authenticate(String username, String password, String token); + public AuthManager authManager(); @Override diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java index 9dc2d20987..498b24f1e4 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java @@ -68,7 +68,7 @@ public final class HugeFactoryAuthProxy { private static final Set PROTECT_METHODS = ImmutableSet.of( "instance"); - private static final Map graphs = new HashMap<>(); + private static final Map GRAPHS = new HashMap<>(); static { HugeGraphAuthProxy.setContext(HugeGraphAuthProxy.Context.admin()); @@ -81,10 +81,10 @@ public static synchronized HugeGraph open(Configuration config) { * TODO: Add verify to StandardHugeGraph() to prevent dynamic creation */ HugeGraph graph = HugeFactory.open(config); - HugeGraph proxy = graphs.get(graph); + HugeGraph proxy = GRAPHS.get(graph); if (proxy == null) { proxy = new HugeGraphAuthProxy(graph); - graphs.put(graph, proxy); + GRAPHS.put(graph, proxy); } return proxy; } @@ -120,16 +120,16 @@ private static void registerPrivateActions() { Reflection.registerFieldsToFilter(com.baidu.hugegraph.auth.HugeGraphAuthProxy.ContextTask.class, "runner", "context"); Reflection.registerFieldsToFilter(com.baidu.hugegraph.StandardHugeGraph.class, "LOG", "started", "closed", "mode", "variables", "name", "params", "configuration", "schemaEventHub", "graphEventHub", "indexEventHub", "writeRateLimiter", "readRateLimiter", "taskManager", "authManager", "features", "storeProvider", "tx", "ramtable", "$assertionsDisabled"); Reflection.registerMethodsToFilter(com.baidu.hugegraph.StandardHugeGraph.class, "lambda$0", "access$3", "access$4", "access$2", "access$5", "access$6", "access$7", "waitUntilAllTasksCompleted", "access$8", "loadStoreProvider", "graphTransaction", "schemaTransaction", "openSchemaTransaction", "checkGraphNotClosed", "openSystemTransaction", "openGraphTransaction", "systemTransaction", "access$9", "access$10", "access$11", "access$12", "access$13", "access$14", "access$15", "access$16", "access$17", "access$18", "serializer", "loadSchemaStore", "loadSystemStore", "loadGraphStore", "closeTx", "analyzer", "serverInfoManager", "reloadRamtable", "reloadRamtable", "access$19", "access$20", "access$21"); - Reflection.registerFieldsToFilter(c("com.baidu.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), "graph", "this$0"); - Reflection.registerMethodsToFilter(c("com.baidu.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), "access$1", "graph"); - Reflection.registerFieldsToFilter(c("com.baidu.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "refs", "opened", "transactions", "this$0", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(c("com.baidu.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "lambda$0", "access$3", "access$2", "lambda$1", "graphTransaction", "schemaTransaction", "systemTransaction", "access$1", "setOpened", "doCommit", "verifyOpened", "doRollback", "doClose", "destroyTransaction", "doOpen", "setClosed", "getOrNewTransaction", "access$0", "resetState"); + Reflection.registerFieldsToFilter(loadClass("com.baidu.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), "graph", "this$0"); + Reflection.registerMethodsToFilter(loadClass("com.baidu.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), "access$1", "graph"); + Reflection.registerFieldsToFilter(loadClass("com.baidu.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "refs", "opened", "transactions", "this$0", "$assertionsDisabled"); + Reflection.registerMethodsToFilter(loadClass("com.baidu.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "lambda$0", "access$3", "access$2", "lambda$1", "graphTransaction", "schemaTransaction", "systemTransaction", "access$1", "setOpened", "doCommit", "verifyOpened", "doRollback", "doClose", "destroyTransaction", "doOpen", "setClosed", "getOrNewTransaction", "access$0", "resetState"); Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class, "readWriteConsumerInternal", "closeConsumerInternal", "transactionListeners"); Reflection.registerMethodsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class, "doClose", "fireOnCommit", "fireOnRollback", "doReadWrite", "lambda$fireOnRollback$1", "lambda$fireOnCommit$0"); Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "g"); Reflection.registerMethodsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "doCommit", "doRollback", "doClose", "doOpen", "fireOnCommit", "fireOnRollback", "doReadWrite"); - Reflection.registerFieldsToFilter(c("com.baidu.hugegraph.StandardHugeGraph$Txs"), "schemaTx", "systemTx", "graphTx", "openedTime", "$assertionsDisabled"); - Reflection.registerMethodsToFilter(c("com.baidu.hugegraph.StandardHugeGraph$Txs"), "access$2", "access$1", "access$0"); + Reflection.registerFieldsToFilter(loadClass("com.baidu.hugegraph.StandardHugeGraph$Txs"), "schemaTx", "systemTx", "graphTx", "openedTime", "$assertionsDisabled"); + Reflection.registerMethodsToFilter(loadClass("com.baidu.hugegraph.StandardHugeGraph$Txs"), "access$2", "access$1", "access$0"); Reflection.registerFieldsToFilter(com.baidu.hugegraph.backend.tx.GraphTransaction.class, "indexTx", "addedVertices", "removedVertices", "addedEdges", "removedEdges", "addedProps", "removedProps", "updatedVertices", "updatedEdges", "updatedOldestProps", "locksTable", "checkCustomVertexExist", "checkAdjacentVertexExist", "lazyLoadAdjacentVertex", "ignoreInvalidEntry", "commitPartOfAdjacentEdges", "batchSize", "pageSize", "verticesCapacity", "edgesCapacity", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy"); Reflection.registerMethodsToFilter(com.baidu.hugegraph.backend.tx.GraphTransaction.class, "lambda$0", "lambda$1", "lambda$2", "lambda$3", "lambda$4", "lambda$5", "lambda$6", "lambda$7", "lambda$8", "lambda$9", "lambda$10", "lambda$11", "lambda$12", "lambda$13", "lambda$14", "lambda$15", "lambda$16", "lambda$17", "lambda$18", "lambda$19", "access$1", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "indexTransaction", "indexTransaction", "beforeWrite", "prepareCommit", "verticesInTxSize", "edgesInTxSize", "checkTxVerticesCapacity", "checkTxEdgesCapacity", "verticesInTxUpdated", "verticesInTxRemoved", "removingEdgeOwner", "prepareDeletions", "prepareDeletions", "prepareUpdates", "prepareAdditions", "checkVertexExistIfCustomizedId", "checkAggregateProperty", "checkAggregateProperty", "checkNonnullProperty", "queryEdgesFromBackend", "commitPartOfEdgeDeletions", "optimizeQueries", "checkVertexLabel", "checkId", "queryVerticesFromBackend", "joinTxVertices", "joinTxEdges", "lockForUpdateProperty", "optimizeQuery", "verifyVerticesConditionQuery", "verifyEdgesConditionQuery", "indexQuery", "joinTxRecords", "propertyUpdated", "parseEntry", "traverseByLabel", "reset", "queryVerticesByIds", "filterUnmatchedRecords", "skipOffsetOrStopLimit", "filterExpiredResultFromFromBackend", "queryEdgesByIds", "matchEdgeSortKeys", "rightResultFromIndexQuery"); Reflection.registerFieldsToFilter(com.baidu.hugegraph.backend.tx.IndexableTransaction.class, "$assertionsDisabled"); @@ -321,7 +321,7 @@ private static boolean registerClass(Class clazz, return true; } - private static Class c(String clazz) { + private static Class loadClass(String clazz) { try { return Class.forName(clazz); } catch (ClassNotFoundException e) { diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java index 8c3846d760..909209556c 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java @@ -44,7 +44,6 @@ import jakarta.ws.rs.NotAuthorizedException; import org.apache.commons.configuration2.Configuration; -import org.apache.groovy.json.internal.MapItemValue; import org.apache.tinkerpop.gremlin.process.computer.GraphComputer; import org.apache.tinkerpop.gremlin.process.traversal.Bytecode; import org.apache.tinkerpop.gremlin.process.traversal.Bytecode.Instruction; @@ -1749,17 +1748,17 @@ public String toString() { } } - private static final ThreadLocal contexts = + private static final ThreadLocal CONTEXTS = new InheritableThreadLocal<>(); protected static final Context setContext(Context context) { - Context old = contexts.get(); - contexts.set(context); + Context old = CONTEXTS.get(); + CONTEXTS.set(context); return old; } protected static final void resetContext() { - contexts.remove(); + CONTEXTS.remove(); } protected static final Context getContext() { @@ -1770,7 +1769,7 @@ protected static final Context getContext() { return new Context(user); } - return contexts.get(); + return CONTEXTS.get(); } protected static final String getContextString() { diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/license/LicenseVerifier.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/license/LicenseVerifier.java index c48ca93bf2..e9fd7cebe9 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/license/LicenseVerifier.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/license/LicenseVerifier.java @@ -55,7 +55,7 @@ private LicenseVerifier() { public static LicenseVerifier instance() { if (INSTANCE == null) { - synchronized(LicenseVerifier.class) { + synchronized (LicenseVerifier.class) { if (INSTANCE == null) { INSTANCE = new LicenseVerifier(); } diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/metrics/MetricsUtil.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/metrics/MetricsUtil.java index 576af23a88..95e3ddedda 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/metrics/MetricsUtil.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/metrics/MetricsUtil.java @@ -30,27 +30,27 @@ public class MetricsUtil { - private static final MetricRegistry registry = + private static final MetricRegistry REGISTRY = MetricManager.INSTANCE.getRegistry(); public static Gauge registerGauge(Class clazz, String name, Gauge gauge) { - return registry.register(MetricRegistry.name(clazz, name), gauge); + return REGISTRY.register(MetricRegistry.name(clazz, name), gauge); } public static Counter registerCounter(Class clazz, String name) { - return registry.counter(MetricRegistry.name(clazz, name)); + return REGISTRY.counter(MetricRegistry.name(clazz, name)); } public static Histogram registerHistogram(Class clazz, String name) { - return registry.histogram(MetricRegistry.name(clazz, name)); + return REGISTRY.histogram(MetricRegistry.name(clazz, name)); } public static Meter registerMeter(Class clazz, String name) { - return registry.meter(MetricRegistry.name(clazz, name)); + return REGISTRY.meter(MetricRegistry.name(clazz, name)); } public static Timer registerTimer(Class clazz, String name) { - return registry.timer(MetricRegistry.name(clazz, name)); + return REGISTRY.timer(MetricRegistry.name(clazz, name)); } } diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/server/ApplicationConfig.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/server/ApplicationConfig.java index b5c0801770..ed392eb644 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/server/ApplicationConfig.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/server/ApplicationConfig.java @@ -101,16 +101,16 @@ private class GraphManagerFactory extends AbstractBinder public GraphManagerFactory(HugeConfig conf, EventHub hub) { register(new ApplicationEventListener() { - private final ApplicationEvent.Type EVENT_INITED = + private final ApplicationEvent.Type eventInited = ApplicationEvent.Type.INITIALIZATION_FINISHED; - private final ApplicationEvent.Type EVENT_DESTROYED = + private final ApplicationEvent.Type eventDestroyed = ApplicationEvent.Type.DESTROY_FINISHED; @Override public void onEvent(ApplicationEvent event) { - if (event.getType() == this.EVENT_INITED) { + if (event.getType() == this.eventInited) { GraphManagerFactory.this.manager = new GraphManager(conf, hub); - } else if (event.getType() == this.EVENT_DESTROYED) { + } else if (event.getType() == this.eventDestroyed) { if (GraphManagerFactory.this.manager != null) { GraphManagerFactory.this.manager.close(); }