This is an automated email from the ASF dual-hosted git repository.
jin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git
The following commit(s) were added to refs/heads/master by this push:
new 6328b8d69 fix checkstyle of core-task issue (#1854)
6328b8d69 is described below
commit 6328b8d691a812c3b03ce8cd0d25c6e838610c12
Author: seagle <[email protected]>
AuthorDate: Thu May 5 18:55:18 2022 +0800
fix checkstyle of core-task issue (#1854)
---
.../main/java/com/baidu/hugegraph/HugeFactory.java | 20 +-
.../main/java/com/baidu/hugegraph/HugeGraph.java | 262 +++++++++++++--------
.../java/com/baidu/hugegraph/HugeGraphParams.java | 69 ++++--
.../com/baidu/hugegraph/StandardHugeGraph.java | 10 +-
.../com/baidu/hugegraph/io/HugeGraphSONModule.java | 14 +-
.../hugegraph/job/computer/AbstractComputer.java | 9 +-
.../hugegraph/job/computer/LouvainComputer.java | 4 +-
.../job/system/DeleteExpiredIndexJob.java | 2 +-
.../hugegraph/plugin/HugeGraphGremlinPlugin.java | 12 +-
.../schema/builder/PropertyKeyBuilder.java | 1 -
.../hugegraph/security/HugeSecurityManager.java | 14 +-
.../java/com/baidu/hugegraph/task/HugeTask.java | 2 +-
.../java/com/baidu/hugegraph/task/TaskManager.java | 8 +-
.../com/baidu/hugegraph/task/TaskScheduler.java | 38 +--
14 files changed, 269 insertions(+), 196 deletions(-)
diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java
index b12e2b137..80c1377a2 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java
@@ -45,7 +45,7 @@ public class HugeFactory {
private static final Logger LOG = Log.logger(HugeGraph.class);
- private static final Thread shutdownHook = new Thread(() -> {
+ private static final Thread SHUT_DOWN_HOOK = new Thread(() -> {
LOG.info("HugeGraph is shutting down");
HugeFactory.shutdown(30L);
}, "hugegraph-shutdown");
@@ -54,14 +54,14 @@ public class HugeFactory {
SerialEnum.registerInternalEnums();
HugeGraph.registerTraversalStrategies(StandardHugeGraph.class);
- Runtime.getRuntime().addShutdownHook(shutdownHook);
+ Runtime.getRuntime().addShutdownHook(SHUT_DOWN_HOOK);
}
private static final String NAME_REGEX = "^[A-Za-z][A-Za-z0-9_]{0,47}$";
- private static final Map<String, HugeGraph> graphs = new HashMap<>();
+ private static final Map<String, HugeGraph> GRAPHS = new HashMap<>();
- private static final AtomicBoolean shutdown = new AtomicBoolean(false);
+ private static final AtomicBoolean SHUT_DOWN = new AtomicBoolean(false);
public static synchronized HugeGraph open(Configuration config) {
HugeConfig conf = config instanceof HugeConfig ?
@@ -86,10 +86,10 @@ public class HugeFactory {
String name = config.get(CoreOptions.STORE);
checkGraphName(name, "graph config(like hugegraph.properties)");
name = name.toLowerCase();
- HugeGraph graph = graphs.get(name);
+ HugeGraph graph = GRAPHS.get(name);
if (graph == null || graph.closed()) {
graph = new StandardHugeGraph(config);
- graphs.put(name, graph);
+ GRAPHS.put(name, graph);
} else {
String backend = config.get(CoreOptions.BACKEND);
E.checkState(backend.equalsIgnoreCase(graph.backend()),
@@ -109,7 +109,7 @@ public class HugeFactory {
public static void remove(HugeGraph graph) {
String name = graph.option(CoreOptions.STORE);
- graphs.remove(name);
+ GRAPHS.remove(name);
}
public static void checkGraphName(String name, String configFile) {
@@ -147,7 +147,7 @@ public class HugeFactory {
* @param timeout seconds
*/
public static void shutdown(long timeout) {
- if (!shutdown.compareAndSet(false, true)) {
+ if (!SHUT_DOWN.compareAndSet(false, true)) {
return;
}
try {
@@ -158,7 +158,7 @@ public class HugeFactory {
OltpTraverser.destroy();
} catch (Throwable e) {
LOG.error("Error while shutdown", e);
- shutdown.compareAndSet(true, false);
+ SHUT_DOWN.compareAndSet(true, false);
throw new HugeException("Failed to shutdown", e);
}
@@ -166,6 +166,6 @@ public class HugeFactory {
}
public static void removeShutdownHook() {
- Runtime.getRuntime().removeShutdownHook(shutdownHook);
+ Runtime.getRuntime().removeShutdownHook(SHUT_DOWN_HOOK);
}
}
diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraph.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraph.java
index 69e495f56..673671c79 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraph.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraph.java
@@ -63,126 +63,184 @@ import com.baidu.hugegraph.type.define.NodeRole;
*/
public interface HugeGraph extends Graph {
- public HugeGraph hugegraph();
-
- public SchemaManager schema();
-
- public Id getNextId(HugeType type);
-
- public Id addPropertyKey(PropertyKey key);
- public Id removePropertyKey(Id key);
- public Id clearPropertyKey(PropertyKey propertyKey);
- public Collection<PropertyKey> propertyKeys();
- public PropertyKey propertyKey(String key);
- public PropertyKey propertyKey(Id key);
- public boolean existsPropertyKey(String key);
-
- public void addVertexLabel(VertexLabel vertexLabel);
- public Id removeVertexLabel(Id label);
- public Collection<VertexLabel> vertexLabels();
- public VertexLabel vertexLabel(String label);
- public VertexLabel vertexLabel(Id label);
- public VertexLabel vertexLabelOrNone(Id id);
- public boolean existsVertexLabel(String label);
- public boolean existsLinkLabel(Id vertexLabel);
-
- public void addEdgeLabel(EdgeLabel edgeLabel);
- public Id removeEdgeLabel(Id label);
- public Collection<EdgeLabel> edgeLabels();
- public EdgeLabel edgeLabel(String label);
- public EdgeLabel edgeLabel(Id label);
- public EdgeLabel edgeLabelOrNone(Id label);
- public boolean existsEdgeLabel(String label);
-
- public void addIndexLabel(SchemaLabel schemaLabel, IndexLabel indexLabel);
- public Id removeIndexLabel(Id label);
- public Id rebuildIndex(SchemaElement schema);
- public Collection<IndexLabel> indexLabels();
- public IndexLabel indexLabel(String label);
- public IndexLabel indexLabel(Id id);
- public boolean existsIndexLabel(String label);
+ HugeGraph hugegraph();
+
+ SchemaManager schema();
+
+ Id getNextId(HugeType type);
+
+ Id addPropertyKey(PropertyKey key);
+
+ Id removePropertyKey(Id key);
+
+ Id clearPropertyKey(PropertyKey propertyKey);
+
+ Collection<PropertyKey> propertyKeys();
+
+ PropertyKey propertyKey(String key);
+
+ PropertyKey propertyKey(Id key);
+
+ boolean existsPropertyKey(String key);
+
+ void addVertexLabel(VertexLabel vertexLabel);
+
+ Id removeVertexLabel(Id label);
+
+ Collection<VertexLabel> vertexLabels();
+
+ VertexLabel vertexLabel(String label);
+
+ VertexLabel vertexLabel(Id label);
+
+ VertexLabel vertexLabelOrNone(Id id);
+
+ boolean existsVertexLabel(String label);
+
+ boolean existsLinkLabel(Id vertexLabel);
+
+ void addEdgeLabel(EdgeLabel edgeLabel);
+
+ Id removeEdgeLabel(Id label);
+
+ Collection<EdgeLabel> edgeLabels();
+
+ EdgeLabel edgeLabel(String label);
+
+ EdgeLabel edgeLabel(Id label);
+
+ EdgeLabel edgeLabelOrNone(Id label);
+
+ boolean existsEdgeLabel(String label);
+
+ void addIndexLabel(SchemaLabel schemaLabel, IndexLabel indexLabel);
+
+ Id removeIndexLabel(Id label);
+
+ Id rebuildIndex(SchemaElement schema);
+
+ Collection<IndexLabel> indexLabels();
+
+ IndexLabel indexLabel(String label);
+
+ IndexLabel indexLabel(Id id);
+
+ boolean existsIndexLabel(String label);
@Override
- public Vertex addVertex(Object... keyValues);
- public void removeVertex(Vertex vertex);
- public void removeVertex(String label, Object id);
- public <V> void addVertexProperty(VertexProperty<V> property);
- public <V> void removeVertexProperty(VertexProperty<V> property);
-
- public Edge addEdge(Edge edge);
- public void canAddEdge(Edge edge);
- public void removeEdge(Edge edge);
- public void removeEdge(String label, Object id);
- public <V> void addEdgeProperty(Property<V> property);
- public <V> void removeEdgeProperty(Property<V> property);
-
- public Vertex vertex(Object object);
+ Vertex addVertex(Object... keyValues);
+
+ void removeVertex(Vertex vertex);
+
+ void removeVertex(String label, Object id);
+
+ <V> void addVertexProperty(VertexProperty<V> property);
+
+ <V> void removeVertexProperty(VertexProperty<V> property);
+
+ Edge addEdge(Edge edge);
+
+ void canAddEdge(Edge edge);
+
+ void removeEdge(Edge edge);
+
+ void removeEdge(String label, Object id);
+
+ <V> void addEdgeProperty(Property<V> property);
+
+ <V> void removeEdgeProperty(Property<V> property);
+
+ Vertex vertex(Object object);
+
@Override
- public Iterator<Vertex> vertices(Object... objects);
- public Iterator<Vertex> vertices(Query query);
- public Iterator<Vertex> adjacentVertex(Object id);
- public boolean checkAdjacentVertexExist();
+ Iterator<Vertex> vertices(Object... objects);
+
+ Iterator<Vertex> vertices(Query query);
+
+ Iterator<Vertex> adjacentVertex(Object id);
+
+ boolean checkAdjacentVertexExist();
+
+ Edge edge(Object object);
- public Edge edge(Object object);
@Override
- public Iterator<Edge> edges(Object... objects);
- public Iterator<Edge> edges(Query query);
- public Iterator<Vertex> adjacentVertices(Iterator<Edge> edges) ;
- public Iterator<Edge> adjacentEdges(Id vertexId);
+ Iterator<Edge> edges(Object... objects);
+
+ Iterator<Edge> edges(Query query);
+
+ Iterator<Vertex> adjacentVertices(Iterator<Edge> edges);
+
+ Iterator<Edge> adjacentEdges(Id vertexId);
- public Number queryNumber(Query query);
+ Number queryNumber(Query query);
- public String name();
- public String backend();
- public String backendVersion();
- public BackendStoreSystemInfo backendStoreSystemInfo();
- public BackendFeatures backendStoreFeatures();
+ String name();
- public GraphMode mode();
- public void mode(GraphMode mode);
+ String backend();
- public GraphReadMode readMode();
- public void readMode(GraphReadMode readMode);
+ String backendVersion();
- public void waitStarted();
- public void serverStarted(Id serverId, NodeRole serverRole);
- public boolean started();
- public boolean closed();
+ BackendStoreSystemInfo backendStoreSystemInfo();
- public <T> T metadata(HugeType type, String meta, Object... args);
+ BackendFeatures backendStoreFeatures();
- public void initBackend();
- public void clearBackend();
- public void truncateBackend();
+ GraphMode mode();
- public void createSnapshot();
- public void resumeSnapshot();
+ void mode(GraphMode mode);
- public void create(String configPath, Id server, NodeRole role);
- public void drop();
+ GraphReadMode readMode();
- public HugeConfig cloneConfig(String newGraph);
+ void readMode(GraphReadMode readMode);
+
+ void waitStarted();
+
+ void serverStarted(Id serverId, NodeRole serverRole);
+
+ boolean started();
+
+ boolean closed();
+
+ <T> T metadata(HugeType type, String meta, Object... args);
+
+ void initBackend();
+
+ void clearBackend();
+
+ void truncateBackend();
+
+ void createSnapshot();
+
+ void resumeSnapshot();
+
+ void create(String configPath, Id server, NodeRole role);
+
+ void drop();
+
+ HugeConfig cloneConfig(String newGraph);
@Override
- public HugeFeatures features();
+ HugeFeatures features();
+
+ AuthManager authManager();
+
+ void switchAuthManager(AuthManager authManager);
+
+ TaskScheduler taskScheduler();
- public AuthManager authManager();
- public void switchAuthManager(AuthManager authManager);
- public TaskScheduler taskScheduler();
- public RaftGroupManager raftGroupManager(String group);
+ RaftGroupManager raftGroupManager(String group);
- public void proxy(HugeGraph graph);
+ void proxy(HugeGraph graph);
- public boolean sameAs(HugeGraph graph);
+ boolean sameAs(HugeGraph graph);
- public long now();
+ long now();
- public <K, V> V option(TypedOption<K, V> option);
+ <K, V> V option(TypedOption<K, V> option);
- public void registerRpcServices(RpcServiceConfig4Server serverConfig,
+ void registerRpcServices(RpcServiceConfig4Server serverConfig,
RpcServiceConfig4Client clientConfig);
- public default List<String> mapPkId2Name(Collection<Id> ids) {
+ default List<String> mapPkId2Name(Collection<Id> ids) {
List<String> names = new ArrayList<>(ids.size());
for (Id id : ids) {
SchemaElement schema = this.propertyKey(id);
@@ -191,7 +249,7 @@ public interface HugeGraph extends Graph {
return names;
}
- public default List<String> mapVlId2Name(Collection<Id> ids) {
+ default List<String> mapVlId2Name(Collection<Id> ids) {
List<String> names = new ArrayList<>(ids.size());
for (Id id : ids) {
SchemaElement schema = this.vertexLabel(id);
@@ -200,7 +258,7 @@ public interface HugeGraph extends Graph {
return names;
}
- public default List<String> mapElId2Name(Collection<Id> ids) {
+ default List<String> mapElId2Name(Collection<Id> ids) {
List<String> names = new ArrayList<>(ids.size());
for (Id id : ids) {
SchemaElement schema = this.edgeLabel(id);
@@ -209,7 +267,7 @@ public interface HugeGraph extends Graph {
return names;
}
- public default List<String> mapIlId2Name(Collection<Id> ids) {
+ default List<String> mapIlId2Name(Collection<Id> ids) {
List<String> names = new ArrayList<>(ids.size());
for (Id id : ids) {
SchemaElement schema = this.indexLabel(id);
@@ -218,7 +276,7 @@ public interface HugeGraph extends Graph {
return names;
}
- public default List<Id> mapPkName2Id(Collection<String> pkeys) {
+ default List<Id> mapPkName2Id(Collection<String> pkeys) {
List<Id> ids = new ArrayList<>(pkeys.size());
for (String pkey : pkeys) {
PropertyKey propertyKey = this.propertyKey(pkey);
@@ -227,7 +285,7 @@ public interface HugeGraph extends Graph {
return ids;
}
- public default Id[] mapElName2Id(String[] edgeLabels) {
+ default Id[] mapElName2Id(String[] edgeLabels) {
Id[] ids = new Id[edgeLabels.length];
for (int i = 0; i < edgeLabels.length; i++) {
EdgeLabel edgeLabel = this.edgeLabel(edgeLabels[i]);
@@ -236,7 +294,7 @@ public interface HugeGraph extends Graph {
return ids;
}
- public default Id[] mapVlName2Id(String[] vertexLabels) {
+ default Id[] mapVlName2Id(String[] vertexLabels) {
Id[] ids = new Id[vertexLabels.length];
for (int i = 0; i < vertexLabels.length; i++) {
VertexLabel vertexLabel = this.vertexLabel(vertexLabels[i]);
@@ -245,7 +303,7 @@ public interface HugeGraph extends Graph {
return ids;
}
- public static void registerTraversalStrategies(Class<?> clazz) {
+ static void registerTraversalStrategies(Class<?> clazz) {
TraversalStrategies strategies = null;
strategies = TraversalStrategies.GlobalCache
.getStrategies(Graph.class)
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraphParams.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraphParams.java
index e30741563..c9853c90a 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraphParams.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraphParams.java
@@ -38,38 +38,55 @@ import com.google.common.util.concurrent.RateLimiter;
*/
public interface HugeGraphParams {
- public HugeGraph graph();
- public String name();
- public GraphMode mode();
- public GraphReadMode readMode();
+ HugeGraph graph();
- public SchemaTransaction schemaTransaction();
- public GraphTransaction systemTransaction();
- public GraphTransaction graphTransaction();
+ String name();
- public GraphTransaction openTransaction();
- public void closeTx();
+ GraphMode mode();
- public boolean started();
- public boolean closed();
- public boolean initialized();
- public BackendFeatures backendStoreFeatures();
+ GraphReadMode readMode();
- public BackendStore loadSchemaStore();
- public BackendStore loadGraphStore();
- public BackendStore loadSystemStore();
+ SchemaTransaction schemaTransaction();
- public EventHub schemaEventHub();
- public EventHub graphEventHub();
- public EventHub indexEventHub();
+ GraphTransaction systemTransaction();
- public HugeConfig configuration();
+ GraphTransaction graphTransaction();
- public ServerInfoManager serverManager();
+ GraphTransaction openTransaction();
- public AbstractSerializer serializer();
- public Analyzer analyzer();
- public RateLimiter writeRateLimiter();
- public RateLimiter readRateLimiter();
- public RamTable ramtable();
+ void closeTx();
+
+ boolean started();
+
+ boolean closed();
+
+ boolean initialized();
+
+ BackendFeatures backendStoreFeatures();
+
+ BackendStore loadSchemaStore();
+
+ BackendStore loadGraphStore();
+
+ BackendStore loadSystemStore();
+
+ EventHub schemaEventHub();
+
+ EventHub graphEventHub();
+
+ EventHub indexEventHub();
+
+ HugeConfig configuration();
+
+ ServerInfoManager serverManager();
+
+ AbstractSerializer serializer();
+
+ Analyzer analyzer();
+
+ RateLimiter writeRateLimiter();
+
+ RateLimiter readRateLimiter();
+
+ RamTable ramtable();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/StandardHugeGraph.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/StandardHugeGraph.java
index bada80de8..f4b969131 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/StandardHugeGraph.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/StandardHugeGraph.java
@@ -112,11 +112,11 @@ import com.google.common.util.concurrent.RateLimiter;
public class StandardHugeGraph implements HugeGraph {
public static final Class<?>[] PROTECT_CLASSES = {
- StandardHugeGraph.class,
- StandardHugeGraph.StandardHugeGraphParams.class,
- TinkerPopTransaction.class,
- StandardHugeGraph.Txs.class,
- StandardHugeGraph.SysTransaction.class
+ StandardHugeGraph.class,
+ StandardHugeGraph.StandardHugeGraphParams.class,
+ TinkerPopTransaction.class,
+ StandardHugeGraph.Txs.class,
+ StandardHugeGraph.SysTransaction.class
};
public static final Set<TypedOption<?, ?>> ALLOWED_CONFIGS =
ImmutableSet.of(
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/io/HugeGraphSONModule.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/io/HugeGraphSONModule.java
index b38caec91..33b89c361 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/io/HugeGraphSONModule.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/io/HugeGraphSONModule.java
@@ -84,7 +84,7 @@ public class HugeGraphSONModule extends
TinkerPopJacksonModule {
@SuppressWarnings("rawtypes")
private static final Map<Class, String> TYPE_DEFINITIONS;
- private static final GraphSONSchemaSerializer schemaSerializer =
+ private static final GraphSONSchemaSerializer SCHEMA_SERIALIZER =
new GraphSONSchemaSerializer();
// NOTE: jackson will synchronize DateFormat
@@ -305,7 +305,7 @@ public class HugeGraphSONModule extends
TinkerPopJacksonModule {
JsonGenerator jsonGenerator,
SerializerProvider provider)
throws IOException {
- writeEntry(jsonGenerator, schemaSerializer.writePropertyKey(pk));
+ writeEntry(jsonGenerator, SCHEMA_SERIALIZER.writePropertyKey(pk));
}
}
@@ -321,7 +321,7 @@ public class HugeGraphSONModule extends
TinkerPopJacksonModule {
JsonGenerator jsonGenerator,
SerializerProvider provider)
throws IOException {
- writeEntry(jsonGenerator, schemaSerializer.writeVertexLabel(vl));
+ writeEntry(jsonGenerator, SCHEMA_SERIALIZER.writeVertexLabel(vl));
}
}
@@ -336,7 +336,7 @@ public class HugeGraphSONModule extends
TinkerPopJacksonModule {
JsonGenerator jsonGenerator,
SerializerProvider provider)
throws IOException {
- writeEntry(jsonGenerator, schemaSerializer.writeEdgeLabel(el));
+ writeEntry(jsonGenerator, SCHEMA_SERIALIZER.writeEdgeLabel(el));
}
}
@@ -352,7 +352,7 @@ public class HugeGraphSONModule extends
TinkerPopJacksonModule {
JsonGenerator jsonGenerator,
SerializerProvider provider)
throws IOException {
- writeEntry(jsonGenerator, schemaSerializer.writeIndexLabel(il));
+ writeEntry(jsonGenerator, SCHEMA_SERIALIZER.writeIndexLabel(il));
}
}
@@ -367,7 +367,7 @@ public class HugeGraphSONModule extends
TinkerPopJacksonModule {
jsonGenerator.writeEndObject();
}
- protected static abstract class HugeElementSerializer<T extends
HugeElement>
+ protected abstract static class HugeElementSerializer<T extends
HugeElement>
extends StdSerializer<T> {
public HugeElementSerializer(Class<T> clazz) {
@@ -410,7 +410,7 @@ public class HugeGraphSONModule extends
TinkerPopJacksonModule {
"Failed to serialize property(%s: %s) " +
"for vertex '%s'", key, val, property.element());
}
- };
+ }
// End write properties
generator.writeEndObject();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/AbstractComputer.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/AbstractComputer.java
index 05db47330..d22810510 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/AbstractComputer.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/AbstractComputer.java
@@ -25,12 +25,9 @@ import java.io.LineNumberReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.apache.commons.configuration.tree.ConfigurationNode;
-import org.apache.commons.configuration2.Configuration;
import org.apache.commons.configuration2.HierarchicalConfiguration;
import org.apache.commons.configuration2.YAMLConfiguration;
import org.apache.commons.configuration2.io.FileHandler;
@@ -117,9 +114,9 @@ public abstract class AbstractComputer implements Computer {
Process process = builder.start();
StringBuilder output = new StringBuilder();
- try(LineNumberReader reader = new LineNumberReader(
- new InputStreamReader(
- process.getInputStream()))) {
+ try (LineNumberReader reader = new LineNumberReader(
+ new InputStreamReader(
+ process.getInputStream()))) {
String line;
while ((line = reader.readLine()) != null) {
output.append(line).append("\n");
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/LouvainComputer.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/LouvainComputer.java
index 7770a84f1..c463ede2e 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/LouvainComputer.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/LouvainComputer.java
@@ -32,13 +32,13 @@ public class LouvainComputer extends AbstractComputer {
public static final String KEY_STABLE_TIMES = "stable_times";
public static final String KEY_PRECISION = "precision";
- public static final String KEY_SHOW_MOD= "show_modularity";
+ public static final String KEY_SHOW_MOD = "show_modularity";
public static final String KEY_SHOW_COMM = "show_community";
public static final String KEY_EXPORT_COMM = "export_community";
public static final String KEY_SKIP_ISOLATED = "skip_isolated";
public static final String KEY_CLEAR = "clear";
- public static final long DEFAULT_STABLE_TIMES= 3L;
+ public static final long DEFAULT_STABLE_TIMES = 3L;
private static final int MAX_TIMES = 2048;
@Override
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/system/DeleteExpiredIndexJob.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/system/DeleteExpiredIndexJob.java
index beca52e75..ede9a03bb 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/system/DeleteExpiredIndexJob.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/system/DeleteExpiredIndexJob.java
@@ -74,7 +74,7 @@ public class DeleteExpiredIndexJob<V> extends
DeleteExpiredJob<V> {
*/
private void deleteExpiredIndex(HugeGraphParams graph, HugeIndex index) {
GraphTransaction tx = graph.graphTransaction();
- HugeType type = index.indexLabel().queryType().isVertex()?
+ HugeType type = index.indexLabel().queryType().isVertex() ?
HugeType.VERTEX : HugeType.EDGE;
IdQuery query = new IdQuery(type);
query.query(index.elementId());
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/plugin/HugeGraphGremlinPlugin.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/plugin/HugeGraphGremlinPlugin.java
index 00b1b73a2..6051a0546 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/plugin/HugeGraphGremlinPlugin.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/plugin/HugeGraphGremlinPlugin.java
@@ -38,11 +38,11 @@ public class HugeGraphGremlinPlugin extends
AbstractGremlinPlugin {
private static final String PACKAGE = "com.baidu.hugegraph.type.define";
private static final String NAME = "HugeGraph";
- private static final HugeGraphGremlinPlugin instance;
- private static final ImportCustomizer imports;
+ private static final HugeGraphGremlinPlugin INSTANCE;
+ private static final ImportCustomizer IMPORTS;
static {
- instance = new HugeGraphGremlinPlugin();
+ INSTANCE = new HugeGraphGremlinPlugin();
Iterator<ClassPath.ClassInfo> classInfos;
try {
@@ -58,16 +58,16 @@ public class HugeGraphGremlinPlugin extends
AbstractGremlinPlugin {
// Add entrance class: graph = HugeFactory.open("hugegraph.properties")
classes.add(HugeFactory.class);
- imports = DefaultImportCustomizer.build()
+ IMPORTS = DefaultImportCustomizer.build()
.addClassImports(classes)
.create();
}
public HugeGraphGremlinPlugin() {
- super(NAME, imports);
+ super(NAME, IMPORTS);
}
public static HugeGraphGremlinPlugin instance() {
- return instance;
+ return INSTANCE;
}
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/schema/builder/PropertyKeyBuilder.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/schema/builder/PropertyKeyBuilder.java
index 4e2d3e9cf..965b5b6fe 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/schema/builder/PropertyKeyBuilder.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/schema/builder/PropertyKeyBuilder.java
@@ -431,7 +431,6 @@ public class PropertyKeyBuilder extends AbstractBuilder
this.aggregateType, this.name, this.dataType);
}
-
if (this.aggregateType.isNumber() &&
!this.dataType.isNumber() && !this.dataType.isDate()) {
throw new NotAllowException(
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java
index 87c93006a..55e33b825 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java
@@ -47,10 +47,10 @@ public class HugeSecurityManager extends SecurityManager {
"org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine"
);
- private static final Set<String> DENIED_PERMISSIONS = ImmutableSet.of(
- "setSecurityManager"
- //"suppressAccessChecks"
- );
+ // TODO: add "suppressAccessChecks"
+ private static final Set<String> DENIED_PERMISSIONS =
ImmutableSet.of("setSecurityManager");
+
+
private static final Set<String> ACCEPT_CLASS_LOADERS = ImmutableSet.of(
"groovy.lang.GroovyClassLoader",
@@ -129,7 +129,7 @@ public class HugeSecurityManager extends SecurityManager {
ImmutableSet.of("newSecurityException")
);
- private static final Set<String> ignoreCheckedClasses = new
CopyOnWriteArraySet<>();
+ private static final Set<String> IGNORE_CHECKED_CLASSES = new
CopyOnWriteArraySet<>();
public static void ignoreCheckedClass(String clazz) {
if (callFromGremlin()) {
@@ -137,7 +137,7 @@ public class HugeSecurityManager extends SecurityManager {
"Not allowed to add ignore check via Gremlin");
}
- ignoreCheckedClasses.add(clazz);
+ IGNORE_CHECKED_CLASSES.add(clazz);
}
@Override
@@ -463,7 +463,7 @@ public class HugeSecurityManager extends SecurityManager {
}
private static boolean callFromIgnoreCheckedClass() {
- return callFromWorkerWithClass(ignoreCheckedClasses);
+ return callFromWorkerWithClass(IGNORE_CHECKED_CLASSES);
}
private static boolean callFromWorkerWithClass(Set<String> classes) {
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/task/HugeTask.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/task/HugeTask.java
index c981e7550..bf60af396 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/task/HugeTask.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/task/HugeTask.java
@@ -637,7 +637,7 @@ public class HugeTask<V> extends FutureTask<V> {
private void checkPropertySize(String property, String propertyName) {
byte[] bytes = StringEncoding.compress(property);
- checkPropertySize(bytes.length, propertyName) ;
+ checkPropertySize(bytes.length, propertyName);
}
private void checkPropertySize(int propertyLength, String propertyName) {
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskManager.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskManager.java
index d99fd2923..8d9040fa6 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskManager.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskManager.java
@@ -322,18 +322,18 @@ public final class TaskManager {
}
}
- private static final ThreadLocal<String> contexts = new ThreadLocal<>();
+ private static final ThreadLocal<String> CONTEXTS = new ThreadLocal<>();
protected static final void setContext(String context) {
- contexts.set(context);
+ CONTEXTS.set(context);
}
protected static final void resetContext() {
- contexts.remove();
+ CONTEXTS.remove();
}
public static final String getContext() {
- return contexts.get();
+ return CONTEXTS.get();
}
public static class ContextCallable<V> implements Callable<V> {
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskScheduler.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskScheduler.java
index da67f13b6..aa12854bf 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskScheduler.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskScheduler.java
@@ -29,35 +29,37 @@ import com.baidu.hugegraph.backend.id.Id;
public interface TaskScheduler {
- public HugeGraph graph();
+ HugeGraph graph();
- public int pendingTasks();
+ int pendingTasks();
- public <V> void restoreTasks();
+ <V> void restoreTasks();
- public <V> Future<?> schedule(HugeTask<V> task);
+ <V> Future<?> schedule(HugeTask<V> task);
- public <V> void cancel(HugeTask<V> task);
+ <V> void cancel(HugeTask<V> task);
- public <V> void save(HugeTask<V> task);
+ <V> void save(HugeTask<V> task);
- public <V> HugeTask<V> delete(Id id);
+ <V> HugeTask<V> delete(Id id);
- public <V> HugeTask<V> task(Id id);
- public <V> Iterator<HugeTask<V>> tasks(List<Id> ids);
- public <V> Iterator<HugeTask<V>> tasks(TaskStatus status,
- long limit, String page);
+ <V> HugeTask<V> task(Id id);
- public boolean close();
+ <V> Iterator<HugeTask<V>> tasks(List<Id> ids);
- public <V> HugeTask<V> waitUntilTaskCompleted(Id id, long seconds)
- throws TimeoutException;
+ <V> Iterator<HugeTask<V>> tasks(TaskStatus status,
+ long limit, String page);
- public <V> HugeTask<V> waitUntilTaskCompleted(Id id)
- throws TimeoutException;
+ boolean close();
- public void waitUntilAllTasksCompleted(long seconds)
+ <V> HugeTask<V> waitUntilTaskCompleted(Id id, long seconds)
throws TimeoutException;
- public void checkRequirement(String op);
+ <V> HugeTask<V> waitUntilTaskCompleted(Id id)
+ throws TimeoutException;
+
+ void waitUntilAllTasksCompleted(long seconds)
+ throws TimeoutException;
+
+ void checkRequirement(String op);
}