This is an automated email from the ASF dual-hosted git repository.
vaughn 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 cc80d2774 fix redundant Checkstyle (#1896)
cc80d2774 is described below
commit cc80d2774528f6858ba5f78642c00c7bd98cb5cf
Author: seagle <[email protected]>
AuthorDate: Sun Oct 30 16:16:21 2022 +0800
fix redundant Checkstyle (#1896)
* add redundant
* add redundant check
* merge line
* update alignment
* delete duplicates check MissingSwitchDefault
* update wrap line
* update code style
* merge dev
* merge master
---
.github/workflows/codeql-analysis.yml | 6 +-
.../com/baidu/hugegraph/api/auth/AccessAPI.java | 1 -
.../com/baidu/hugegraph/api/gremlin/CypherAPI.java | 11 ++--
.../baidu/hugegraph/api/gremlin/GremlinAPI.java | 11 ----
.../api/traversers/JaccardSimilarityAPI.java | 4 +-
.../baidu/hugegraph/auth/HugeAuthenticator.java | 60 ++++++++++----------
.../baidu/hugegraph/auth/HugeGraphAuthProxy.java | 10 ++--
.../hugegraph/auth/WsAndHttpBasicAuthHandler.java | 6 +-
.../java/com/baidu/hugegraph/define/Checkable.java | 4 +-
.../com/baidu/hugegraph/serializer/Serializer.java | 65 ++++++++++------------
.../com/baidu/hugegraph/analyzer/Analyzer.java | 2 +-
.../com/baidu/hugegraph/backend/Transaction.java | 10 ++--
.../com/baidu/hugegraph/backend/cache/Cache.java | 48 ++++++++--------
.../hugegraph/backend/cache/CacheNotifier.java | 12 ++--
.../backend/cache/CachedGraphTransaction.java | 8 +--
.../backend/cache/CachedSchemaTransaction.java | 16 +++---
.../hugegraph/backend/cache/OffheapCache.java | 6 +-
.../java/com/baidu/hugegraph/backend/id/Id.java | 24 ++++----
.../baidu/hugegraph/backend/id/IdGenerator.java | 2 +-
.../baidu/hugegraph/backend/page/QueryList.java | 6 +-
.../baidu/hugegraph/backend/query/Aggregate.java | 6 +-
.../hugegraph/backend/query/ConditionQuery.java | 4 +-
.../com/baidu/hugegraph/backend/query/Query.java | 2 +-
.../store/AbstractBackendStoreProvider.java | 1 -
.../hugegraph/backend/store/BackendFeatures.java | 48 ++++++++--------
.../hugegraph/backend/store/BackendMetrics.java | 30 +++++-----
.../backend/store/raft/RaftGroupManager.java | 14 ++---
.../baidu/hugegraph/backend/store/ram/RamMap.java | 8 +--
.../src/main/java/com/baidu/hugegraph/job/Job.java | 4 +-
.../com/baidu/hugegraph/job/computer/Computer.java | 8 +--
.../baidu/hugegraph/plugin/HugeGraphPlugin.java | 16 +++---
.../hugegraph/rpc/RpcServiceConfig4Client.java | 10 ++--
.../hugegraph/rpc/RpcServiceConfig4Server.java | 10 ++--
.../hugegraph/schema/builder/SchemaBuilder.java | 16 +++---
.../java/com/baidu/hugegraph/task/TaskManager.java | 6 +-
.../traversal/algorithm/records/Records.java | 14 ++---
.../traversal/algorithm/records/record/Record.java | 12 ++--
.../algorithm/strategy/TraverseStrategy.java | 20 +++----
.../hugegraph/traversal/optimize/QueryHolder.java | 20 +++----
.../java/com/baidu/hugegraph/type/Idfiable.java | 2 +-
.../java/com/baidu/hugegraph/type/Indexable.java | 2 +-
.../java/com/baidu/hugegraph/type/Nameable.java | 2 +-
.../com/baidu/hugegraph/type/Propertiable.java | 2 +-
.../java/com/baidu/hugegraph/type/Typeable.java | 2 +-
.../com/baidu/hugegraph/type/define/GraphMode.java | 2 +-
.../baidu/hugegraph/type/define/GraphReadMode.java | 2 +-
.../com/baidu/hugegraph/type/define/NodeRole.java | 2 +-
.../java/com/baidu/hugegraph/util/RateLimiter.java | 8 +--
.../hugegraph/util/collection/IntIterator.java | 32 +++++------
.../baidu/hugegraph/util/collection/IntMap.java | 16 +++---
.../baidu/hugegraph/util/collection/IntSet.java | 36 ++++++------
.../util/collection/ObjectIntMapping.java | 6 +-
.../backend/store/hbase/HbaseSessions.java | 58 ++++++++++---------
.../hugegraph/backend/store/hbase/HbaseStore.java | 2 +-
.../backend/store/rocksdb/RocksDBSessions.java | 2 +-
.../backend/store/rocksdb/RocksDBStore.java | 15 ++---
.../com/baidu/hugegraph/unit/UnitTestSuite.java | 1 -
style/checkstyle.xml | 5 +-
58 files changed, 367 insertions(+), 391 deletions(-)
diff --git a/.github/workflows/codeql-analysis.yml
b/.github/workflows/codeql-analysis.yml
index 1d4b13bc5..5bcfa103c 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -37,7 +37,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@v2
+ uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a
config file.
@@ -48,7 +48,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually
(see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@v2
+ uses: github/codeql-action/autobuild@v1
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -62,4 +62,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v2
+ uses: github/codeql-action/analyze@v1
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java
index 5bf9c223b..7e9b61e2e 100644
--- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java
+++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java
@@ -21,7 +21,6 @@ package com.baidu.hugegraph.api.auth;
import java.util.List;
-import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/gremlin/CypherAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/gremlin/CypherAPI.java
index ac0bb63a5..082ff6bc7 100644
--- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/gremlin/CypherAPI.java
+++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/gremlin/CypherAPI.java
@@ -47,7 +47,6 @@ public class CypherAPI extends GremlinQueryAPI {
private static final Logger LOG = Log.logger(CypherAPI.class);
-
@GET
@Timed
@CompressInterceptor.Compress(buffer = (1024 * 40))
@@ -82,11 +81,11 @@ public class CypherAPI extends GremlinQueryAPI {
LOG.debug("translated gremlin is {}", gremlin);
String auth = headers.getHeaderString(HttpHeaders.AUTHORIZATION);
- String request = "{"
- + "\"gremlin\":\"" + gremlin + "\","
- + "\"bindings\":{},"
- + "\"language\":\"gremlin-groovy\","
- + "\"aliases\":{\"g\":\"__g_" + graph + "\"}}";
+ String request = "{" +
+ "\"gremlin\":\"" + gremlin + "\"," +
+ "\"bindings\":{}," +
+ "\"language\":\"gremlin-groovy\"," +
+ "\"aliases\":{\"g\":\"__g_" + graph + "\"}}";
Response response = this.client().doPostRequest(auth, request);
return transformResponseIfNeeded(response);
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 8f1e8504a..f1283f8f5 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
@@ -19,9 +19,6 @@
package com.baidu.hugegraph.api.gremlin;
-import java.util.Map;
-import java.util.Set;
-
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
@@ -30,22 +27,15 @@ import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.HttpHeaders;
-import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
-import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.api.filter.CompressInterceptor.Compress;
import com.baidu.hugegraph.config.HugeConfig;
-import com.baidu.hugegraph.config.ServerOptions;
-import com.baidu.hugegraph.exception.HugeGremlinException;
import com.baidu.hugegraph.metrics.MetricsUtil;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.annotation.Timed;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import jakarta.inject.Provider;
import jakarta.inject.Singleton;
@Path("gremlin")
@@ -58,7 +48,6 @@ public class GremlinAPI extends GremlinQueryAPI {
private static final Histogram GREMLIN_OUTPUT_HISTOGRAM =
MetricsUtil.registerHistogram(GremlinAPI.class, "gremlin-output");
-
@POST
@Timed
@Compress
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPI.java
index fbe09c9a3..d8ec29562 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPI.java
@@ -86,8 +86,8 @@ public class JaccardSimilarityAPI extends TraverserAPI {
double similarity;
try (JaccardSimilarTraverser traverser =
new JaccardSimilarTraverser(g)) {
- similarity = traverser.jaccardSimilarity(sourceId, targetId, dir,
- edgeLabel, maxDegree);
+ similarity = traverser.jaccardSimilarity(sourceId, targetId, dir,
+ edgeLabel, maxDegree);
}
return JsonUtil.toJson(ImmutableMap.of("jaccard_similarity",
similarity));
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 b6369b355..88c5c7870 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
@@ -43,36 +43,33 @@ import com.baidu.hugegraph.util.JsonUtil;
public interface HugeAuthenticator extends Authenticator {
- public static final String KEY_USERNAME =
- CredentialGraphTokens.PROPERTY_USERNAME;
- public static final String KEY_PASSWORD =
- CredentialGraphTokens.PROPERTY_PASSWORD;
- public static final String KEY_TOKEN = "token";
- public static final String KEY_ROLE = "role";
- public static final String KEY_ADDRESS = "address";
- public static final String KEY_PATH = "path";
+ String KEY_USERNAME = CredentialGraphTokens.PROPERTY_USERNAME;
+ String KEY_PASSWORD = CredentialGraphTokens.PROPERTY_PASSWORD;
+ String KEY_TOKEN = "token";
+ String KEY_ROLE = "role";
+ String KEY_ADDRESS = "address";
+ String KEY_PATH = "path";
- public static final String USER_SYSTEM = "system";
- public static final String USER_ADMIN = "admin";
- public static final String USER_ANONY =
AuthenticatedUser.ANONYMOUS_USERNAME;
+ String USER_SYSTEM = "system";
+ String USER_ADMIN = "admin";
+ String USER_ANONY = AuthenticatedUser.ANONYMOUS_USERNAME;
- public static final RolePermission ROLE_NONE = RolePermission.none();
- public static final RolePermission ROLE_ADMIN = RolePermission.admin();
+ RolePermission ROLE_NONE = RolePermission.none();
+ RolePermission ROLE_ADMIN = RolePermission.admin();
- public static final String VAR_PREFIX = "$";
- public static final String KEY_OWNER = VAR_PREFIX + "owner";
- public static final String KEY_DYNAMIC = VAR_PREFIX + "dynamic";
- public static final String KEY_ACTION = VAR_PREFIX + "action";
+ String VAR_PREFIX = "$";
+ String KEY_OWNER = VAR_PREFIX + "owner";
+ String KEY_DYNAMIC = VAR_PREFIX + "dynamic";
+ String KEY_ACTION = VAR_PREFIX + "action";
- public void setup(HugeConfig config);
+ void setup(HugeConfig config);
- public UserWithRole authenticate(String username, String password,
- String token);
+ UserWithRole authenticate(String username, String password, String token);
- public AuthManager authManager();
+ AuthManager authManager();
@Override
- public default void setup(final Map<String, Object> config) {
+ default void setup(final Map<String, Object> config) {
E.checkState(config != null,
"Must provide a 'config' in the 'authentication'");
String path = (String) config.get("tokens");
@@ -83,8 +80,9 @@ public interface HugeAuthenticator extends Authenticator {
}
@Override
- public default User authenticate(final Map<String, String> credentials)
- throws AuthenticationException {
+ default User authenticate(final Map<String, String> credentials)
+ throws AuthenticationException {
+
HugeGraphAuthProxy.resetContext();
User user = User.ANONYMOUS;
@@ -115,11 +113,11 @@ public interface HugeAuthenticator extends Authenticator {
}
@Override
- public default boolean requireAuthentication() {
+ default boolean requireAuthentication() {
return true;
}
- public default boolean verifyRole(RolePermission role) {
+ default boolean verifyRole(RolePermission role) {
if (role == ROLE_NONE || role == null) {
return false;
} else {
@@ -127,9 +125,9 @@ public interface HugeAuthenticator extends Authenticator {
}
}
- public void initAdminUser(String password) throws Exception;
+ void initAdminUser(String password) throws Exception;
- public static HugeAuthenticator loadAuthenticator(HugeConfig conf) {
+ static HugeAuthenticator loadAuthenticator(HugeConfig conf) {
String authClass = conf.get(ServerOptions.AUTHENTICATOR);
if (authClass.isEmpty()) {
return null;
@@ -150,7 +148,7 @@ public interface HugeAuthenticator extends Authenticator {
return authenticator;
}
- public static class User extends AuthenticatedUser {
+ class User extends AuthenticatedUser {
public static final User ADMIN = new User(USER_ADMIN, ROLE_ADMIN);
public static final User ANONYMOUS = new User(USER_ANONY, ROLE_ADMIN);
@@ -255,7 +253,7 @@ public interface HugeAuthenticator extends Authenticator {
}
}
- public static class RolePerm {
+ class RolePerm {
@JsonProperty("roles") // graph -> action -> resource
private Map<String, Map<HugePermission, Object>> roles;
@@ -395,7 +393,7 @@ public interface HugeAuthenticator extends Authenticator {
}
}
- public static class RequiredPerm {
+ class RequiredPerm {
@JsonProperty("owner")
private String owner;
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 ad7fd3a7e..78a3fabf0 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
@@ -1790,17 +1790,17 @@ public final class HugeGraphAuthProxy implements
HugeGraph {
private static final ThreadLocal<Context> CONTEXTS = new
InheritableThreadLocal<>();
- protected static final Context setContext(Context context) {
+ protected static Context setContext(Context context) {
Context old = CONTEXTS.get();
CONTEXTS.set(context);
return old;
}
- protected static final void resetContext() {
+ protected static void resetContext() {
CONTEXTS.remove();
}
- protected static final Context getContext() {
+ protected static Context getContext() {
// Return task context first
String taskContext = TaskManager.getContext();
User user = User.fromJson(taskContext);
@@ -1811,7 +1811,7 @@ public final class HugeGraphAuthProxy implements
HugeGraph {
return CONTEXTS.get();
}
- protected static final String getContextString() {
+ protected static String getContextString() {
Context context = getContext();
if (context == null) {
return null;
@@ -1819,7 +1819,7 @@ public final class HugeGraphAuthProxy implements
HugeGraph {
return context.user().toJson();
}
- protected static final void logUser(User user, String path) {
+ protected static void logUser(User user, String path) {
LOG.info("User '{}' login from client [{}] with path '{}'",
user.username(), user.client(), path);
}
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/WsAndHttpBasicAuthHandler.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/WsAndHttpBasicAuthHandler.java
index 514d8e03d..580173bd9 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/WsAndHttpBasicAuthHandler.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/WsAndHttpBasicAuthHandler.java
@@ -150,10 +150,10 @@ public class WsAndHttpBasicAuthHandler extends
SaslAuthenticationHandler {
}
}
- private void sendError(ChannelHandlerContext ctx, Object msg) {
+ private void sendError(ChannelHandlerContext context, Object msg) {
// Close the connection as soon as the error message is sent.
- ctx.writeAndFlush(new DefaultFullHttpResponse(HTTP_1_1,
UNAUTHORIZED))
- .addListener(ChannelFutureListener.CLOSE);
+ context.writeAndFlush(new DefaultFullHttpResponse(HTTP_1_1,
UNAUTHORIZED))
+ .addListener(ChannelFutureListener.CLOSE);
ReferenceCountUtil.release(msg);
}
}
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/define/Checkable.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/define/Checkable.java
index bbd5b27e3..387bf12b7 100644
--- a/hugegraph-api/src/main/java/com/baidu/hugegraph/define/Checkable.java
+++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/define/Checkable.java
@@ -21,9 +21,9 @@ package com.baidu.hugegraph.define;
public interface Checkable {
- public void checkCreate(boolean isBatch);
+ void checkCreate(boolean isBatch);
- public default void checkUpdate() {
+ default void checkUpdate() {
this.checkCreate(false);
}
}
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/serializer/Serializer.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/serializer/Serializer.java
index a7544d036..e5b1c1bce 100644
--- a/hugegraph-api/src/main/java/com/baidu/hugegraph/serializer/Serializer.java
+++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/serializer/Serializer.java
@@ -42,65 +42,60 @@ import
com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser
public interface Serializer {
- public String writeMap(Map<?, ?> map);
+ String writeMap(Map<?, ?> map);
- public String writeList(String label, Collection<?> list);
+ String writeList(String label, Collection<?> list);
- public String writePropertyKey(PropertyKey propertyKey);
+ String writePropertyKey(PropertyKey propertyKey);
- public String writePropertyKeys(List<PropertyKey> propertyKeys);
+ String writePropertyKeys(List<PropertyKey> propertyKeys);
- public String writeVertexLabel(VertexLabel vertexLabel);
+ String writeVertexLabel(VertexLabel vertexLabel);
- public String writeVertexLabels(List<VertexLabel> vertexLabels);
+ String writeVertexLabels(List<VertexLabel> vertexLabels);
- public String writeEdgeLabel(EdgeLabel edgeLabel);
+ String writeEdgeLabel(EdgeLabel edgeLabel);
- public String writeEdgeLabels(List<EdgeLabel> edgeLabels);
+ String writeEdgeLabels(List<EdgeLabel> edgeLabels);
- public String writeIndexlabel(IndexLabel indexLabel);
+ String writeIndexlabel(IndexLabel indexLabel);
- public String writeIndexlabels(List<IndexLabel> indexLabels);
+ String writeIndexlabels(List<IndexLabel> indexLabels);
- public String writeTaskWithSchema(SchemaElement.TaskWithSchema tws);
+ String writeTaskWithSchema(SchemaElement.TaskWithSchema tws);
- public String writeVertex(Vertex v);
+ String writeVertex(Vertex v);
- public String writeVertices(Iterator<Vertex> vertices, boolean paging);
+ String writeVertices(Iterator<Vertex> vertices, boolean paging);
- public String writeEdge(Edge e);
+ String writeEdge(Edge e);
- public String writeEdges(Iterator<Edge> edges, boolean paging);
+ String writeEdges(Iterator<Edge> edges, boolean paging);
- public String writeIds(List<Id> ids);
+ String writeIds(List<Id> ids);
- public String writeAuthElement(AuthElement elem);
+ String writeAuthElement(AuthElement elem);
- public <V extends AuthElement> String writeAuthElements(String label,
- List<V> users);
+ <V extends AuthElement> String writeAuthElements(String label, List<V>
users);
- public String writePaths(String name, Collection<HugeTraverser.Path> paths,
- boolean withCrossPoint, Iterator<Vertex>
vertices);
+ String writePaths(String name, Collection<HugeTraverser.Path> paths,
+ boolean withCrossPoint, Iterator<Vertex> vertices);
- public default String writePaths(String name,
- Collection<HugeTraverser.Path> paths,
- boolean withCrossPoint) {
+ default String writePaths(String name, Collection<HugeTraverser.Path>
paths,
+ boolean withCrossPoint) {
return this.writePaths(name, paths, withCrossPoint, null);
}
- public String writeCrosspoints(CrosspointsPaths paths,
- Iterator<Vertex> iterator, boolean
withPath);
+ String writeCrosspoints(CrosspointsPaths paths, Iterator<Vertex> iterator,
+ boolean withPath);
- public String writeSimilars(SimilarsMap similars,
- Iterator<Vertex> vertices);
+ String writeSimilars(SimilarsMap similars, Iterator<Vertex> vertices);
- public String writeWeightedPath(NodeWithWeight path,
- Iterator<Vertex> vertices);
+ String writeWeightedPath(NodeWithWeight path, Iterator<Vertex> vertices);
- public String writeWeightedPaths(WeightedPaths paths,
- Iterator<Vertex> vertices);
+ String writeWeightedPaths(WeightedPaths paths, Iterator<Vertex> vertices);
- public String writeNodesWithPath(String name, List<Id> nodes, long size,
- Collection<HugeTraverser.Path> paths,
- Iterator<Vertex> vertices);
+ String writeNodesWithPath(String name, List<Id> nodes, long size,
+ Collection<HugeTraverser.Path> paths,
+ Iterator<Vertex> vertices);
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/analyzer/Analyzer.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/analyzer/Analyzer.java
index 52ce194ee..8cc137221 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/analyzer/Analyzer.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/analyzer/Analyzer.java
@@ -23,5 +23,5 @@ import java.util.Set;
public interface Analyzer {
- public Set<String> segment(String text);
+ Set<String> segment(String text);
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/Transaction.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/Transaction.java
index b3c066b1e..bbf20a2b3 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/Transaction.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/Transaction.java
@@ -21,13 +21,13 @@ package com.baidu.hugegraph.backend;
public interface Transaction {
- public void commit() throws BackendException;
+ void commit() throws BackendException;
- public void commitIfGtSize(int size) throws BackendException;
+ void commitIfGtSize(int size) throws BackendException;
- public void rollback() throws BackendException;
+ void rollback() throws BackendException;
- public boolean autoCommit();
+ boolean autoCommit();
- public void close();
+ void close();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/Cache.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/Cache.java
index 7212a4b7f..f7f98efcd 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/Cache.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/Cache.java
@@ -24,48 +24,48 @@ import java.util.function.Function;
public interface Cache<K, V> {
- public static final String ACTION_INVALID = "invalid";
- public static final String ACTION_CLEAR = "clear";
- public static final String ACTION_INVALIDED = "invalided";
- public static final String ACTION_CLEARED = "cleared";
+ String ACTION_INVALID = "invalid";
+ String ACTION_CLEAR = "clear";
+ String ACTION_INVALIDED = "invalided";
+ String ACTION_CLEARED = "cleared";
- public V get(K id);
+ V get(K id);
- public V getOrFetch(K id, Function<K, V> fetcher);
+ V getOrFetch(K id, Function<K, V> fetcher);
- public boolean containsKey(K id);
+ boolean containsKey(K id);
- public boolean update(K id, V value);
+ boolean update(K id, V value);
- public boolean update(K id, V value, long timeOffset);
+ boolean update(K id, V value, long timeOffset);
- public boolean updateIfAbsent(K id, V value);
+ boolean updateIfAbsent(K id, V value);
- public boolean updateIfPresent(K id, V value);
+ boolean updateIfPresent(K id, V value);
- public void invalidate(K id);
+ void invalidate(K id);
- public void traverse(Consumer<V> consumer);
+ void traverse(Consumer<V> consumer);
- public void clear();
+ void clear();
- public void expire(long ms);
+ void expire(long ms);
- public long expire();
+ long expire();
- public long tick();
+ long tick();
- public long capacity();
+ long capacity();
- public long size();
+ long size();
- public boolean enableMetrics(boolean enabled);
+ boolean enableMetrics(boolean enabled);
- public long hits();
+ long hits();
- public long miss();
+ long miss();
- public <T> T attachment(T object);
+ <T> T attachment(T object);
- public <T> T attachment();
+ <T> T attachment();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CacheNotifier.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CacheNotifier.java
index 39154807a..784d8e691 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CacheNotifier.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CacheNotifier.java
@@ -24,15 +24,15 @@ import com.baidu.hugegraph.type.HugeType;
public interface CacheNotifier extends AutoCloseable {
- public void invalid(HugeType type, Id id);
+ void invalid(HugeType type, Id id);
- public void invalid2(HugeType type, Object[] ids);
+ void invalid2(HugeType type, Object[] ids);
- public void clear(HugeType type);
+ void clear(HugeType type);
- public void reload();
+ void reload();
- public interface GraphCacheNotifier extends CacheNotifier {}
+ interface GraphCacheNotifier extends CacheNotifier {}
- public interface SchemaCacheNotifier extends CacheNotifier {}
+ interface SchemaCacheNotifier extends CacheNotifier {}
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedGraphTransaction.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedGraphTransaction.java
index fed55dc8f..6ba16dca9 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedGraphTransaction.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedGraphTransaction.java
@@ -235,7 +235,7 @@ public final class CachedGraphTransaction extends
GraphTransaction {
@Override
@Watched(prefix = "graphcache")
- protected final Iterator<HugeVertex> queryVerticesFromBackend(Query query)
{
+ protected Iterator<HugeVertex> queryVerticesFromBackend(Query query) {
if (this.enableCacheVertex() &&
query.idsSize() > 0 && query.conditionsSize() == 0) {
return this.queryVerticesByIds((IdQuery) query);
@@ -307,7 +307,7 @@ public final class CachedGraphTransaction extends
GraphTransaction {
@Override
@Watched(prefix = "graphcache")
- protected final Iterator<HugeEdge> queryEdgesFromBackend(Query query) {
+ protected Iterator<HugeEdge> queryEdgesFromBackend(Query query) {
RamTable ramtable = this.params().ramtable();
if (ramtable != null && ramtable.matched(query)) {
return ramtable.query(query);
@@ -362,7 +362,7 @@ public final class CachedGraphTransaction extends
GraphTransaction {
@Override
@Watched(prefix = "graphcache")
- protected final void commitMutation2Backend(BackendMutation... mutations) {
+ protected void commitMutation2Backend(BackendMutation... mutations) {
// Collect changes before commit
Collection<HugeVertex> updates = this.verticesInTxUpdated();
Collection<HugeVertex> deletions = this.verticesInTxRemoved();
@@ -414,7 +414,7 @@ public final class CachedGraphTransaction extends
GraphTransaction {
}
@Override
- public final void removeIndex(IndexLabel indexLabel) {
+ public void removeIndex(IndexLabel indexLabel) {
try {
super.removeIndex(indexLabel);
} finally {
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedSchemaTransaction.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedSchemaTransaction.java
index 331b038df..a145b53fa 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedSchemaTransaction.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedSchemaTransaction.java
@@ -137,22 +137,22 @@ public final class CachedSchemaTransaction extends
SchemaTransaction {
schemaEventHub.unlisten(Events.CACHE, this.cacheEventListener);
}
- private final void notifyChanges(String action, HugeType type, Id id) {
+ private void notifyChanges(String action, HugeType type, Id id) {
EventHub graphEventHub = this.params().schemaEventHub();
graphEventHub.notify(Events.CACHE, action, type, id);
}
- private final void notifyChanges(String action, HugeType type) {
+ private void notifyChanges(String action, HugeType type) {
EventHub graphEventHub = this.params().schemaEventHub();
graphEventHub.notify(Events.CACHE, action, type);
}
- private final void resetCachedAll(HugeType type) {
+ private void resetCachedAll(HugeType type) {
// Set the cache all flag of the schema type to false
this.cachedTypes().put(type, false);
}
- private final void resetCachedAllIfReachedCapacity() {
+ private void resetCachedAllIfReachedCapacity() {
if (this.idCache.size() >= this.idCache.capacity()) {
LOG.warn("Schema cache reached capacity({}): {}",
this.idCache.capacity(), this.idCache.size());
@@ -160,11 +160,11 @@ public final class CachedSchemaTransaction extends
SchemaTransaction {
}
}
- private final CachedTypes cachedTypes() {
+ private CachedTypes cachedTypes() {
return this.arrayCaches.cachedTypes();
}
- private final void clearCache(boolean notify) {
+ private void clearCache(boolean notify) {
this.idCache.clear();
this.nameCache.clear();
this.arrayCaches.clear();
@@ -174,7 +174,7 @@ public final class CachedSchemaTransaction extends
SchemaTransaction {
}
}
- private final void updateCache(SchemaElement schema) {
+ private void updateCache(SchemaElement schema) {
this.resetCachedAllIfReachedCapacity();
// update id cache
@@ -189,7 +189,7 @@ public final class CachedSchemaTransaction extends
SchemaTransaction {
this.arrayCaches.updateIfNeeded(schema);
}
- private final void invalidateCache(HugeType type, Id id) {
+ private void invalidateCache(HugeType type, Id id) {
// remove from id cache and name cache
Id prefixedId = generateId(type, id);
Object value = this.idCache.get(prefixedId);
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/OffheapCache.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/OffheapCache.java
index 993809750..cc3ccf05c 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/OffheapCache.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/OffheapCache.java
@@ -346,7 +346,7 @@ public class OffheapCache extends AbstractCache<Id, Object>
{
}
}
- private static enum ValueType {
+ private enum ValueType {
UNKNOWN,
LIST,
@@ -365,11 +365,11 @@ public class OffheapCache extends AbstractCache<Id,
Object> {
private DataType dataType;
- private ValueType() {
+ ValueType() {
this(DataType.UNKNOWN);
}
- private ValueType(DataType dataType) {
+ ValueType(DataType dataType) {
this.dataType = dataType;
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/Id.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/Id.java
index 78afad482..06cf053cf 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/Id.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/Id.java
@@ -23,37 +23,37 @@ import com.baidu.hugegraph.util.E;
public interface Id extends Comparable<Id> {
- public static final int UUID_LENGTH = 16;
+ int UUID_LENGTH = 16;
- public Object asObject();
+ Object asObject();
- public String asString();
+ String asString();
- public long asLong();
+ long asLong();
- public byte[] asBytes();
+ byte[] asBytes();
- public int length();
+ int length();
- public IdType type();
+ IdType type();
- public default boolean number() {
+ default boolean number() {
return this.type() == IdType.LONG;
}
- public default boolean uuid() {
+ default boolean uuid() {
return this.type() == IdType.UUID;
}
- public default boolean string() {
+ default boolean string() {
return this.type() == IdType.STRING;
}
- public default boolean edge() {
+ default boolean edge() {
return this.type() == IdType.EDGE;
}
- public enum IdType {
+ enum IdType {
UNKNOWN,
LONG,
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/IdGenerator.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/IdGenerator.java
index 3ab42ee77..a6b0b829b 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/IdGenerator.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/IdGenerator.java
@@ -121,7 +121,7 @@ public abstract class IdGenerator {
return IdType.UNKNOWN;
}
- private static final int compareType(Id id1, Id id2) {
+ private static int compareType(Id id1, Id id2) {
return idType(id1).ordinal() - idType(id2).ordinal();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/page/QueryList.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/page/QueryList.java
index 4e2094586..a72ef072d 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/page/QueryList.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/page/QueryList.java
@@ -130,7 +130,7 @@ public final class QueryList<R> {
* For non-paging situation
* @return BackendEntry iterator
*/
- public QueryResults<R> iterator();
+ QueryResults<R> iterator();
/**
* For paging situation
@@ -139,9 +139,9 @@ public final class QueryList<R> {
* @param pageSize set query page size
* @return BackendEntry iterator with page
*/
- public PageResults<R> iterator(int index, String page, long pageSize);
+ PageResults<R> iterator(int index, String page, long pageSize);
- public int total();
+ int total();
}
/**
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Aggregate.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Aggregate.java
index a9a0439a1..a5e5041e3 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Aggregate.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Aggregate.java
@@ -60,7 +60,7 @@ public class Aggregate {
this.column == null ? "*" : this.column);
}
- public static enum AggregateFunc {
+ public enum AggregateFunc {
COUNT("count", 0L, NumberHelper::add),
MAX("max", -Double.MAX_VALUE, NumberHelper::max),
@@ -72,8 +72,8 @@ public class Aggregate {
private final Number defaultValue;
private final BiFunction<Number, Number, Number> merger;
- private AggregateFunc(String name, Number defaultValue,
- BiFunction<Number, Number, Number> merger) {
+ AggregateFunc(String name, Number defaultValue,
+ BiFunction<Number, Number, Number> merger) {
this.name = name;
this.defaultValue = defaultValue;
this.merger = merger;
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
index 7deb444bc..6ccfbc025 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
@@ -875,8 +875,8 @@ public class ConditionQuery extends IdQuery {
}
}
- public static interface ResultsFilter {
+ public interface ResultsFilter {
- public boolean test(HugeElement element);
+ boolean test(HugeElement element);
}
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Query.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Query.java
index 49e1fd8f4..397b313b5 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Query.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Query.java
@@ -577,7 +577,7 @@ public class Query implements Cloneable {
}
}
- public static enum Order {
+ public enum Order {
ASC,
DESC;
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/AbstractBackendStoreProvider.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/AbstractBackendStoreProvider.java
index 71075a31d..c94a25fcd 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/AbstractBackendStoreProvider.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/AbstractBackendStoreProvider.java
@@ -26,7 +26,6 @@ import java.util.concurrent.Future;
import org.slf4j.Logger;
import com.alipay.remoting.rpc.RpcServer;
-import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.backend.BackendException;
import com.baidu.hugegraph.backend.store.raft.StoreSnapshotFile;
import com.baidu.hugegraph.config.CoreOptions;
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendFeatures.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendFeatures.java
index cef6523e3..c1dac2780 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendFeatures.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendFeatures.java
@@ -21,57 +21,57 @@ package com.baidu.hugegraph.backend.store;
public interface BackendFeatures {
- public default boolean supportsPersistence() {
+ default boolean supportsPersistence() {
return true;
}
- public default boolean supportsSharedStorage() {
+ default boolean supportsSharedStorage() {
return true;
}
- public default boolean supportsSnapshot() {
+ default boolean supportsSnapshot() {
return false;
}
- public boolean supportsScanToken();
+ boolean supportsScanToken();
- public boolean supportsScanKeyPrefix();
+ boolean supportsScanKeyPrefix();
- public boolean supportsScanKeyRange();
+ boolean supportsScanKeyRange();
- public boolean supportsQuerySchemaByName();
+ boolean supportsQuerySchemaByName();
- public boolean supportsQueryByLabel();
+ boolean supportsQueryByLabel();
- public boolean supportsQueryWithInCondition();
+ boolean supportsQueryWithInCondition();
- public boolean supportsQueryWithRangeCondition();
+ boolean supportsQueryWithRangeCondition();
- public boolean supportsQueryWithContains();
+ boolean supportsQueryWithContains();
- public boolean supportsQueryWithContainsKey();
+ boolean supportsQueryWithContainsKey();
- public boolean supportsQueryWithOrderBy();
+ boolean supportsQueryWithOrderBy();
- public boolean supportsQueryByPage();
+ boolean supportsQueryByPage();
- public boolean supportsQuerySortByInputIds();
+ boolean supportsQuerySortByInputIds();
- public boolean supportsDeleteEdgeByLabel();
+ boolean supportsDeleteEdgeByLabel();
- public boolean supportsUpdateVertexProperty();
+ boolean supportsUpdateVertexProperty();
- public boolean supportsMergeVertexProperty();
+ boolean supportsMergeVertexProperty();
- public boolean supportsUpdateEdgeProperty();
+ boolean supportsUpdateEdgeProperty();
- public boolean supportsTransaction();
+ boolean supportsTransaction();
- public boolean supportsNumberType();
+ boolean supportsNumberType();
- public boolean supportsAggregateProperty();
+ boolean supportsAggregateProperty();
- public boolean supportsTtl();
+ boolean supportsTtl();
- public boolean supportsOlapProperties();
+ boolean supportsOlapProperties();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMetrics.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMetrics.java
index e621c2e44..1a103f154 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMetrics.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMetrics.java
@@ -23,27 +23,27 @@ import java.util.Map;
public interface BackendMetrics {
- public String BACKEND = "backend";
+ String BACKEND = "backend";
- public String NODES = "nodes";
- public String CLUSTER_ID = "cluster_id";
- public String SERVERS = "servers";
- public String SERVER_LOCAL = "local";
- public String SERVER_CLUSTER = "cluster";
+ String NODES = "nodes";
+ String CLUSTER_ID = "cluster_id";
+ String SERVERS = "servers";
+ String SERVER_LOCAL = "local";
+ String SERVER_CLUSTER = "cluster";
// Memory related metrics
- public String MEM_USED = "mem_used";
- public String MEM_COMMITTED = "mem_committed";
- public String MEM_MAX = "mem_max";
- public String MEM_UNIT = "mem_unit";
+ String MEM_USED = "mem_used";
+ String MEM_COMMITTED = "mem_committed";
+ String MEM_MAX = "mem_max";
+ String MEM_UNIT = "mem_unit";
// Data load related metrics
- public String DISK_USAGE = "disk_usage";
- public String DISK_UNIT = "disk_unit";
+ String DISK_USAGE = "disk_usage";
+ String DISK_UNIT = "disk_unit";
- public String READABLE = "_readable";
+ String READABLE = "_readable";
- public String EXCEPTION = "exception";
+ String EXCEPTION = "exception";
- public Map<String, Object> metrics();
+ Map<String, Object> metrics();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/RaftGroupManager.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/RaftGroupManager.java
index c15ca4e89..7a786863b 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/RaftGroupManager.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/RaftGroupManager.java
@@ -23,17 +23,17 @@ import java.util.List;
public interface RaftGroupManager {
- public String group();
+ String group();
- public List<String> listPeers();
+ List<String> listPeers();
- public String getLeader();
+ String getLeader();
- public String transferLeaderTo(String endpoint);
+ String transferLeaderTo(String endpoint);
- public String setLeader(String endpoint);
+ String setLeader(String endpoint);
- public String addPeer(String endpoint);
+ String addPeer(String endpoint);
- public String removePeer(String endpoint);
+ String removePeer(String endpoint);
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/ram/RamMap.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/ram/RamMap.java
index 62c72a4c0..456f97e58 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/ram/RamMap.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/ram/RamMap.java
@@ -25,11 +25,11 @@ import java.io.IOException;
public interface RamMap {
- public void clear();
+ void clear();
- public long size();
+ long size();
- public void writeTo(DataOutputStream buffer) throws IOException;
+ void writeTo(DataOutputStream buffer) throws IOException;
- public void readFrom(DataInputStream buffer) throws IOException;
+ void readFrom(DataInputStream buffer) throws IOException;
}
diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/Job.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/Job.java
index 3b7063d4b..32325a96f 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/Job.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/Job.java
@@ -21,7 +21,7 @@ package com.baidu.hugegraph.job;
public interface Job<V> {
- public String type();
+ String type();
- public V execute() throws Exception;
+ V execute() throws Exception;
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/Computer.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/Computer.java
index 5d9521754..f73579659 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/Computer.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/computer/Computer.java
@@ -25,11 +25,11 @@ import com.baidu.hugegraph.job.Job;
public interface Computer {
- public String name();
+ String name();
- public String category();
+ String category();
- public Object call(Job<Object> job, Map<String, Object> parameters);
+ Object call(Job<Object> job, Map<String, Object> parameters);
- public void checkParameters(Map<String, Object> parameters);
+ void checkParameters(Map<String, Object> parameters);
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/plugin/HugeGraphPlugin.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/plugin/HugeGraphPlugin.java
index c0897eab8..742e56ef4 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/plugin/HugeGraphPlugin.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/plugin/HugeGraphPlugin.java
@@ -26,27 +26,27 @@ import com.baidu.hugegraph.config.OptionSpace;
public interface HugeGraphPlugin {
- public String name();
+ String name();
- public void register();
+ void register();
- public String supportsMinVersion();
+ String supportsMinVersion();
- public String supportsMaxVersion();
+ String supportsMaxVersion();
- public static void registerOptions(String name, String classPath) {
+ static void registerOptions(String name, String classPath) {
OptionSpace.register(name, classPath);
}
- public static void registerBackend(String name, String classPath) {
+ static void registerBackend(String name, String classPath) {
BackendProviderFactory.register(name, classPath);
}
- public static void registerSerializer(String name, String classPath) {
+ static void registerSerializer(String name, String classPath) {
SerializerFactory.register(name, classPath);
}
- public static void registerAnalyzer(String name, String classPath) {
+ static void registerAnalyzer(String name, String classPath) {
AnalyzerFactory.register(name, classPath);
}
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Client.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Client.java
index 13cfca96f..0833980d9 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Client.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Client.java
@@ -21,17 +21,17 @@ package com.baidu.hugegraph.rpc;
public interface RpcServiceConfig4Client {
- public <T> T serviceProxy(String interfaceId);
+ <T> T serviceProxy(String interfaceId);
- public <T> T serviceProxy(String graph, String interfaceId);
+ <T> T serviceProxy(String graph, String interfaceId);
- public default <T> T serviceProxy(Class<T> clazz) {
+ default <T> T serviceProxy(Class<T> clazz) {
return this.serviceProxy(clazz.getName());
}
- public default <T> T serviceProxy(String graph, Class<T> clazz) {
+ default <T> T serviceProxy(String graph, Class<T> clazz) {
return this.serviceProxy(graph, clazz.getName());
}
- public void removeAllServiceProxy();
+ void removeAllServiceProxy();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Server.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Server.java
index 7139073cf..23541e313 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Server.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Server.java
@@ -21,12 +21,12 @@ package com.baidu.hugegraph.rpc;
public interface RpcServiceConfig4Server {
- public <T, S extends T> String addService(Class<T> clazz, S serviceImpl);
+ <T, S extends T> String addService(Class<T> clazz, S serviceImpl);
- public <T, S extends T> String addService(String graph,
- Class<T> clazz, S serviceImpl);
+ <T, S extends T> String addService(String graph, Class<T> clazz,
+ S serviceImpl);
- public void removeService(String serviceId);
+ void removeService(String serviceId);
- public void removeAllService();
+ void removeAllService();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/schema/builder/SchemaBuilder.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/schema/builder/SchemaBuilder.java
index 8f0b74e78..f09d4644a 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/schema/builder/SchemaBuilder.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/schema/builder/SchemaBuilder.java
@@ -24,19 +24,19 @@ import com.baidu.hugegraph.schema.SchemaElement;
public interface SchemaBuilder<T extends SchemaElement> {
- public SchemaBuilder<T> id(long id);
+ SchemaBuilder<T> id(long id);
- public T build();
+ T build();
- public T create();
+ T create();
- public T append();
+ T append();
- public T eliminate();
+ T eliminate();
- public Id remove();
+ Id remove();
- public SchemaBuilder<T> ifNotExist();
+ SchemaBuilder<T> ifNotExist();
- public SchemaBuilder<T> checkExist(boolean checkExist);
+ SchemaBuilder<T> checkExist(boolean checkExist);
}
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 8d9040fa6..723391e0b 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
@@ -324,15 +324,15 @@ public final class TaskManager {
private static final ThreadLocal<String> CONTEXTS = new ThreadLocal<>();
- protected static final void setContext(String context) {
+ protected static void setContext(String context) {
CONTEXTS.set(context);
}
- protected static final void resetContext() {
+ protected static void resetContext() {
CONTEXTS.remove();
}
- public static final String getContext() {
+ public static String getContext() {
return CONTEXTS.get();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/records/Records.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/records/Records.java
index 405ed933e..d5444cd82 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/records/Records.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/records/Records.java
@@ -26,16 +26,16 @@ import
com.baidu.hugegraph.traversal.algorithm.HugeTraverser.PathSet;
public interface Records {
- public void startOneLayer(boolean forward);
+ void startOneLayer(boolean forward);
- public void finishOneLayer();
+ void finishOneLayer();
- public boolean hasNextKey();
+ boolean hasNextKey();
- public Id nextKey();
+ Id nextKey();
- public PathSet findPath(Id target, Function<Id, Boolean> filter,
- boolean all, boolean ring);
+ PathSet findPath(Id target, Function<Id, Boolean> filter, boolean all,
+ boolean ring);
- public long accessed();
+ long accessed();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/records/record/Record.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/records/record/Record.java
index f138243fe..0f50fa7b1 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/records/record/Record.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/records/record/Record.java
@@ -23,15 +23,15 @@ import com.baidu.hugegraph.util.collection.IntIterator;
public interface Record {
- public IntIterator keys();
+ IntIterator keys();
- public boolean containsKey(int node);
+ boolean containsKey(int node);
- public IntIterator get(int node);
+ IntIterator get(int node);
- public void addPath(int node, int parent);
+ void addPath(int node, int parent);
- public int size();
+ int size();
- public boolean concurrent();
+ boolean concurrent();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/strategy/TraverseStrategy.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/strategy/TraverseStrategy.java
index 9bfc2759b..9d69e5cb5 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/strategy/TraverseStrategy.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/strategy/TraverseStrategy.java
@@ -31,22 +31,20 @@ import
com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
public interface TraverseStrategy {
- public abstract void traverseOneLayer(
- Map<Id, List<HugeTraverser.Node>> vertices,
- EdgeStep step, BiConsumer<Id, EdgeStep> consumer);
+ void traverseOneLayer(Map<Id, List<HugeTraverser.Node>> vertices,
+ EdgeStep step, BiConsumer<Id, EdgeStep> consumer);
- public abstract Map<Id, List<HugeTraverser.Node>> newMultiValueMap();
+ Map<Id, List<HugeTraverser.Node>> newMultiValueMap();
- public abstract Set<HugeTraverser.Path> newPathSet();
+ Set<HugeTraverser.Path> newPathSet();
- public abstract void addNode(Map<Id, List<HugeTraverser.Node>> vertices,
- Id id, HugeTraverser.Node node);
+ void addNode(Map<Id, List<HugeTraverser.Node>> vertices, Id id,
+ HugeTraverser.Node node);
- public abstract void addNewVerticesToAll(
- Map<Id, List<HugeTraverser.Node>> newVertices,
- Map<Id, List<HugeTraverser.Node>> targets);
+ void addNewVerticesToAll(Map<Id, List<HugeTraverser.Node>> newVertices,
+ Map<Id, List<HugeTraverser.Node>> targets);
- public static TraverseStrategy create(boolean concurrent, HugeGraph graph)
{
+ static TraverseStrategy create(boolean concurrent, HugeGraph graph) {
return concurrent ? new ConcurrentTraverseStrategy(graph) :
new SingleTraverseStrategy(graph);
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/QueryHolder.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/QueryHolder.java
index 4cb344254..7584e4c55 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/QueryHolder.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/QueryHolder.java
@@ -30,12 +30,12 @@ import com.baidu.hugegraph.iterator.Metadatable;
public interface QueryHolder extends HasContainerHolder, Metadatable {
- public static final String SYSPROP_PAGE = "~page";
+ String SYSPROP_PAGE = "~page";
- public Iterator<?> lastTimeResults();
+ Iterator<?> lastTimeResults();
@Override
- public default Object metadata(String meta, Object... args) {
+ default Object metadata(String meta, Object... args) {
Iterator<?> results = this.lastTimeResults();
if (results instanceof Metadatable) {
return ((Metadatable) results).metadata(meta, args);
@@ -43,30 +43,30 @@ public interface QueryHolder extends HasContainerHolder,
Metadatable {
throw new IllegalStateException("Original results is not Metadatable");
}
- public Query queryInfo();
+ Query queryInfo();
- public default void orderBy(String key, Order order) {
+ default void orderBy(String key, Order order) {
this.queryInfo().order(TraversalUtil.string2HugeKey(key),
TraversalUtil.convOrder(order));
}
- public default long setRange(long start, long end) {
+ default long setRange(long start, long end) {
return this.queryInfo().range(start, end);
}
- public default void setPage(String page) {
+ default void setPage(String page) {
this.queryInfo().page(page);
}
- public default void setCount() {
+ default void setCount() {
this.queryInfo().capacity(Query.NO_CAPACITY);
}
- public default void setAggregate(AggregateFunc func, String key) {
+ default void setAggregate(AggregateFunc func, String key) {
this.queryInfo().aggregate(func, key);
}
- public default <Q extends Query> Q injectQueryInfo(Q query) {
+ default <Q extends Query> Q injectQueryInfo(Q query) {
query.copyBasic(this.queryInfo());
return query;
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Idfiable.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Idfiable.java
index 62e40c087..d2ab141e8 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Idfiable.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Idfiable.java
@@ -23,5 +23,5 @@ import com.baidu.hugegraph.backend.id.Id;
public interface Idfiable {
- public Id id();
+ Id id();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Indexable.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Indexable.java
index 6085e5235..08cb386f9 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Indexable.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Indexable.java
@@ -25,5 +25,5 @@ import com.baidu.hugegraph.backend.id.Id;
public interface Indexable {
- public Set<Id> indexLabels();
+ Set<Id> indexLabels();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Nameable.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Nameable.java
index 8d4ba418c..eb8e474e4 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Nameable.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Nameable.java
@@ -25,6 +25,6 @@ public interface Nameable {
*
* @return Name of this entity.
*/
- public String name();
+ String name();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Propertiable.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Propertiable.java
index 666633b1a..4ca8df77b 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Propertiable.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Propertiable.java
@@ -25,5 +25,5 @@ import com.baidu.hugegraph.backend.id.Id;
public interface Propertiable {
- public Set<Id> properties();
+ Set<Id> properties();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Typeable.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Typeable.java
index c80785732..fb569fd02 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Typeable.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/type/Typeable.java
@@ -22,5 +22,5 @@ package com.baidu.hugegraph.type;
public interface Typeable {
// Return schema/data type
- public HugeType type();
+ HugeType type();
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/type/define/GraphMode.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/type/define/GraphMode.java
index 97e5d143a..906051fe5 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/type/define/GraphMode.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/type/define/GraphMode.java
@@ -50,7 +50,7 @@ public enum GraphMode {
private final byte code;
private final String name;
- private GraphMode(int code, String name) {
+ GraphMode(int code, String name) {
assert code < 256;
this.code = (byte) code;
this.name = name;
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/type/define/GraphReadMode.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/type/define/GraphReadMode.java
index 5fe85368e..6c1b70d7e 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/type/define/GraphReadMode.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/type/define/GraphReadMode.java
@@ -30,7 +30,7 @@ public enum GraphReadMode {
private final byte code;
private final String name;
- private GraphReadMode(int code, String name) {
+ GraphReadMode(int code, String name) {
assert code < 256;
this.code = (byte) code;
this.name = name;
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/type/define/NodeRole.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/type/define/NodeRole.java
index 645854dc4..c824b022a 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/type/define/NodeRole.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/type/define/NodeRole.java
@@ -30,7 +30,7 @@ public enum NodeRole implements SerialEnum {
private final byte code;
private final String name;
- private NodeRole(int code, String name) {
+ NodeRole(int code, String name) {
assert code < 256;
this.code = (byte) code;
this.name = name;
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/RateLimiter.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/RateLimiter.java
index a1bd4952d..c2983da68 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/RateLimiter.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/RateLimiter.java
@@ -24,15 +24,13 @@ import org.slf4j.Logger;
// TODO: Move to common module (concurrent package)
public interface RateLimiter {
- public final Logger LOG = Log.logger(RateLimiter.class);
-
- public final long RESET_PERIOD = 1000L;
+ long RESET_PERIOD = 1000L;
/**
* Acquires one permit from RateLimiter if it can be acquired immediately
* without delay.
*/
- public boolean tryAcquire();
+ boolean tryAcquire();
/**
* Create a RateLimiter with specified rate, to keep compatible with
@@ -43,7 +41,7 @@ public interface RateLimiter {
*
* TODO: refactor it to make method unchangeable
*/
- public static RateLimiter create(double ratePerSecond) {
+ static RateLimiter create(double ratePerSecond) {
return new FixedTimerWindowRateLimiter((int) ratePerSecond);
}
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/IntIterator.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/IntIterator.java
index 7f9f52f2f..e780dd56a 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/IntIterator.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/IntIterator.java
@@ -26,14 +26,14 @@ import java.util.NoSuchElementException;
public interface IntIterator {
- public final int[] EMPTY_INTS = new int[0];
- public final IntIterator EMPTY = new EmptyIntIterator();
+ int[] EMPTY_INTS = new int[0];
+ IntIterator EMPTY = new EmptyIntIterator();
- public boolean hasNext();
+ boolean hasNext();
- public int next();
+ int next();
- public default Iterator<Integer> asIterator() {
+ default Iterator<Integer> asIterator() {
return new Iterator<Integer>() {
@Override
@@ -48,20 +48,20 @@ public interface IntIterator {
};
}
- public static IntIterator wrap(
+ static IntIterator wrap(
org.eclipse.collections.api.iterator.IntIterator iter) {
return new EcIntIterator(iter);
}
- public static IntIterator wrap(int[] values) {
+ static IntIterator wrap(int[] values) {
return new ArrayIntIterator(values);
}
- public static IntIterator wrap(int value) {
+ static IntIterator wrap(int value) {
return new ArrayIntIterator(new int[]{value});
}
- public final class EcIntIterator implements IntIterator {
+ final class EcIntIterator implements IntIterator {
private final org.eclipse.collections.api.iterator.IntIterator
iterator;
@@ -81,7 +81,7 @@ public interface IntIterator {
}
}
- public final class ArrayIntIterator implements IntIterator {
+ final class ArrayIntIterator implements IntIterator {
private final int[] array;
private int index;
@@ -102,7 +102,7 @@ public interface IntIterator {
}
}
- public final class EmptyIntIterator implements IntIterator {
+ final class EmptyIntIterator implements IntIterator {
@Override
public boolean hasNext() {
@@ -115,7 +115,7 @@ public interface IntIterator {
}
}
- public final class IntIterators implements IntIterator {
+ final class IntIterators implements IntIterator {
private final List<IntIterator> iters;
private int currentIndex;
@@ -158,7 +158,7 @@ public interface IntIterator {
}
}
- public final class MapperInt2IntIterator implements IntIterator {
+ final class MapperInt2IntIterator implements IntIterator {
private final IntIterator originIter;
private final IntMapper intMapper;
@@ -180,11 +180,11 @@ public interface IntIterator {
public interface IntMapper {
- public int map(int key);
+ int map(int key);
}
}
- public final class MapperInt2ObjectIterator<T> implements Iterator<T> {
+ final class MapperInt2ObjectIterator<T> implements Iterator<T> {
private final IntIterator originIter;
private final IntMapper<T> intMapper;
@@ -207,7 +207,7 @@ public interface IntIterator {
public interface IntMapper<T> {
- public T map(int key);
+ T map(int key);
}
}
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/IntMap.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/IntMap.java
index 3bd5a1419..5d624d5be 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/IntMap.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/IntMap.java
@@ -199,7 +199,7 @@ public interface IntMap {
return true;
}
- private final IntMap segment(int key) {
+ private IntMap segment(int key) {
long ukey = key + this.unsignedSize;
if (ukey >= this.capacity || ukey < 0L) {
E.checkArgument(false,
@@ -233,7 +233,7 @@ public interface IntMap {
}
}
- private final IntMap segmentAt(int index) {
+ private IntMap segmentAt(int index) {
// volatile get this.maps[index]
long offset = (index << SHIFT) + BASE_OFFSET;
IntMap map = (IntMap) UNSAFE.getObjectVolatile(this.maps, offset);
@@ -247,7 +247,7 @@ public interface IntMap {
* - faster 8x than ec IntIntHashMap for 4 threads, 4x operations
* with 0.5x cost;
*/
- public static final class IntMapByFixedAddr implements IntMap {
+ final class IntMapByFixedAddr implements IntMap {
private final int[] values;
private final int capacity;
@@ -397,7 +397,7 @@ public interface IntMap {
return true;
}
- private final long offset(int key) {
+ private long offset(int key) {
if (key >= this.capacity || key < 0) {
E.checkArgument(false, "The key %s is out of bound %s",
key, this.capacity);
@@ -509,7 +509,7 @@ public interface IntMap {
}
}
- public static final class IntMapByEcSegment implements IntMap {
+ final class IntMapByEcSegment implements IntMap {
private final MutableIntIntMap[] maps;
private final int segmentMask;
@@ -529,7 +529,7 @@ public interface IntMap {
}
}
- private final MutableIntIntMap map(int key) {
+ private MutableIntIntMap map(int key) {
// NOTE '%' is slower 20% ~ 50% than '&': key % this.maps.length;
int index = key & this.segmentMask;
return this.maps[index];
@@ -597,6 +597,6 @@ public interface IntMap {
}
}
- public static final int NULL_VALUE = Integer.MIN_VALUE;
- public static final Unsafe UNSAFE = IntSet.UNSAFE;
+ int NULL_VALUE = Integer.MIN_VALUE;
+ Unsafe UNSAFE = IntSet.UNSAFE;
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/IntSet.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/IntSet.java
index 5a070f1ea..82f56a0a6 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/IntSet.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/IntSet.java
@@ -151,7 +151,7 @@ public interface IntSet {
return true;
}
- private final IntSet segment(int key) {
+ private IntSet segment(int key) {
long ukey = key + this.unsignedSize;
if (ukey >= this.capacity || ukey < 0L) {
E.checkArgument(false,
@@ -185,7 +185,7 @@ public interface IntSet {
}
}
- private final IntSet segmentAt(int index) {
+ private IntSet segmentAt(int index) {
// volatile get this.sets[index]
long offset = (index << SHIFT) + BASE_OFFSET;
IntSet set = (IntSet) UNSAFE.getObjectVolatile(this.sets, offset);
@@ -201,7 +201,7 @@ public interface IntSet {
* - faster 20x than ec IntIntHashSet-segment-lock for 4 threads;
* - faster 60x than ec IntIntHashSet-global-lock for 4 threads;
*/
- public static final class IntSetByFixedAddr implements IntSet {
+ final class IntSetByFixedAddr implements IntSet {
private final long[] bits;
private final long numBits;
@@ -284,7 +284,7 @@ public interface IntSet {
return true;
}
- private final long offset(long key) {
+ private long offset(long key) {
long ukey = key + this.numBitsUnsigned;
if (ukey >= this.numBits || ukey < 0L) {
E.checkArgument(false, "The key %s is out of bound %s",
@@ -294,7 +294,7 @@ public interface IntSet {
}
}
- public static final class IntSetByFixedAddr4Unsigned implements IntSet {
+ final class IntSetByFixedAddr4Unsigned implements IntSet {
private final long[] bits;
private final int numBits;
@@ -422,7 +422,7 @@ public interface IntSet {
return key;
}
- private final long offset(int key) {
+ private long offset(int key) {
if (key >= this.numBits || key < 0) {
E.checkArgument(false, "The key %s is out of bound %s",
key, this.numBits);
@@ -430,7 +430,7 @@ public interface IntSet {
return bitOffsetToByteOffset(key);
}
- private static final long bitOffsetToByteOffset(long key) {
+ private static long bitOffsetToByteOffset(long key) {
// bits to long offset
long index = key >> DIV64;
// long offset to byte offset
@@ -440,14 +440,14 @@ public interface IntSet {
return offset;
}
- private static final long bitmaskOfKey(long key) {
+ private static long bitmaskOfKey(long key) {
long bitIndex = key & MOD64;
long bitmask = 1L << bitIndex;
return bitmask;
}
}
- public static final class IntSetByEcSegment implements IntSet {
+ final class IntSetByEcSegment implements IntSet {
private final MutableIntCollection[] sets;
private final int segmentMask;
@@ -467,7 +467,7 @@ public interface IntSet {
}
}
- private final MutableIntCollection set(int key) {
+ private MutableIntCollection set(int key) {
// NOTE '%' is slower 20% ~ 50% than '&': key % this.sets.length;
int index = key & this.segmentMask;
return this.sets[index];
@@ -510,7 +510,7 @@ public interface IntSet {
}
}
- public static final class IntSetByFixedAddrByHppc implements IntSet {
+ final class IntSetByFixedAddrByHppc implements IntSet {
private final com.carrotsearch.hppc.BitSet bits;
@@ -551,13 +551,13 @@ public interface IntSet {
}
}
- public static final int CPUS = Runtime.getRuntime().availableProcessors();
- public static final sun.misc.Unsafe UNSAFE = UnsafeAccess.UNSAFE;
+ int CPUS = Runtime.getRuntime().availableProcessors();
+ sun.misc.Unsafe UNSAFE = UnsafeAccess.UNSAFE;
- public static final long MOD64 = 0x3fL;
- public static final int DIV64 = 6;
+ long MOD64 = 0x3fL;
+ int DIV64 = 6;
- public static int segmentSize(long capacity, int segments) {
+ static int segmentSize(long capacity, int segments) {
long eachSize = capacity / segments;
eachSize = IntSet.sizeToPowerOf2Size((int) eachSize);
/*
@@ -571,7 +571,7 @@ public interface IntSet {
return (int) eachSize;
}
- public static int sizeToPowerOf2Size(int size) {
+ static int sizeToPowerOf2Size(int size) {
if (size < 1) {
size = 1;
}
@@ -587,7 +587,7 @@ public interface IntSet {
return size;
}
- public static int bits2words(long numBits) {
+ static int bits2words(long numBits) {
return (int) ((numBits - 1) >>> DIV64) + 1;
}
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/ObjectIntMapping.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/ObjectIntMapping.java
index 21737092d..072439b80 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/ObjectIntMapping.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/ObjectIntMapping.java
@@ -21,9 +21,9 @@ package com.baidu.hugegraph.util.collection;
public interface ObjectIntMapping<V> {
- public int object2Code(Object object);
+ int object2Code(Object object);
- public V code2Object(int code);
+ V code2Object(int code);
- public void clear();
+ void clear();
}
diff --git
a/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseSessions.java
b/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseSessions.java
index 35d8e051c..03d0d5596 100644
---
a/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseSessions.java
+++
b/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseSessions.java
@@ -231,7 +231,7 @@ public class HbaseSessions extends BackendSessionPool {
}
}
- public void createPreSplitTable(String table, List<byte[]> cfs,
+ public void createPreSplitTable(String table, List<byte[]> cfs,
short numOfPartitions) throws IOException {
TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(
TableName.valueOf(this.namespace, table));
@@ -331,20 +331,20 @@ public class HbaseSessions extends BackendSessionPool {
/**
* Add a row record to a table
*/
- public abstract void put(String table, byte[] family, byte[] rowkey,
- Collection<BackendColumn> columns);
+ void put(String table, byte[] family, byte[] rowkey,
+ Collection<BackendColumn> columns);
/**
* Add a row record to a table(can be used when adding an index)
*/
- public abstract void put(String table, byte[] family,
- byte[] rowkey, byte[] qualifier, byte[]
value);
+ void put(String table, byte[] family, byte[] rowkey, byte[] qualifier,
+ byte[] value);
/**
* Delete a record by rowkey and qualifier from a table
*/
- public default void remove(String table, byte[] family,
- byte[] rowkey, byte[] qualifier) {
+ default void remove(String table, byte[] family, byte[] rowkey,
+ byte[] qualifier) {
this.remove(table, family, rowkey, qualifier, false);
}
@@ -352,34 +352,33 @@ public class HbaseSessions extends BackendSessionPool {
* Delete a record by rowkey and qualifier from a table,
* just delete the latest version of the specified column if need
*/
- public void remove(String table, byte[] family, byte[] rowkey,
- byte[] qualifier, boolean latestVersion);
+ void remove(String table, byte[] family, byte[] rowkey,
+ byte[] qualifier, boolean latestVersion);
/**
* Delete a record by rowkey from a table
*/
- public void delete(String table, byte[] family, byte[] rowkey);
+ void delete(String table, byte[] family, byte[] rowkey);
/**
* Get a record by rowkey and qualifier from a table
*/
- public R get(String table, byte[] family, byte[] rowkey,
- byte[] qualifier);
+ R get(String table, byte[] family, byte[] rowkey, byte[] qualifier);
/**
* Get a record by rowkey from a table
*/
- public R get(String table, byte[] family, byte[] rowkey);
+ R get(String table, byte[] family, byte[] rowkey);
/**
* Get multi records by rowkeys from a table
*/
- public R get(String table, byte[] family, Set<byte[]> rowkeys);
+ R get(String table, byte[] family, Set<byte[]> rowkeys);
/**
* Scan all records from a table
*/
- public default R scan(String table, long limit) {
+ default R scan(String table, long limit) {
Scan scan = new Scan();
if (limit >= 0) {
scan.setFilter(new PageFilter(limit));
@@ -390,14 +389,14 @@ public class HbaseSessions extends BackendSessionPool {
/**
* Scan records by rowkey prefix from a table
*/
- public default R scan(String table, byte[] prefix) {
+ default R scan(String table, byte[] prefix) {
return this.scan(table, prefix, true, prefix);
}
/**
* Scan records by multi rowkey prefixes from a table
*/
- public default R scan(String table, Set<byte[]> prefixes) {
+ default R scan(String table, Set<byte[]> prefixes) {
FilterList orFilters = new FilterList(Operator.MUST_PASS_ONE);
for (byte[] prefix : prefixes) {
FilterList andFilters = new FilterList(Operator.MUST_PASS_ALL);
@@ -416,8 +415,8 @@ public class HbaseSessions extends BackendSessionPool {
/**
* Scan records by rowkey start and prefix from a table
*/
- public default R scan(String table, byte[] startRow,
- boolean inclusiveStart, byte[] prefix) {
+ default R scan(String table, byte[] startRow, boolean inclusiveStart,
+ byte[] prefix) {
Scan scan = new Scan().withStartRow(startRow, inclusiveStart)
.setFilter(new PrefixFilter(prefix));
return this.scan(table, scan);
@@ -426,16 +425,15 @@ public class HbaseSessions extends BackendSessionPool {
/**
* Scan records by rowkey range from a table
*/
- public default R scan(String table, byte[] startRow, byte[] stopRow) {
+ default R scan(String table, byte[] startRow, byte[] stopRow) {
return this.scan(table, startRow, true, stopRow, false);
}
/**
* Scan records by rowkey range from a table
*/
- public default R scan(String table,
- byte[] startRow, boolean inclusiveStart,
- byte[] stopRow, boolean inclusiveStop) {
+ default R scan(String table, byte[] startRow, boolean inclusiveStart,
+ byte[] stopRow, boolean inclusiveStop) {
Scan scan = new Scan().withStartRow(startRow, inclusiveStart);
if (stopRow != null) {
scan.withStopRow(stopRow, inclusiveStop);
@@ -446,20 +444,20 @@ public class HbaseSessions extends BackendSessionPool {
/**
* Inner scan: send scan request to HBase and get iterator
*/
- public R scan(String table, Scan scan);
+ R scan(String table, Scan scan);
/**
* Increase a counter by rowkey and qualifier to a table
*/
- public long increase(String table, byte[] family,
- byte[] rowkey, byte[] qualifier, long value);
+ long increase(String table, byte[] family, byte[] rowkey,
+ byte[] qualifier, long value);
}
/**
* Session implement for HBase
*/
public class Session extends AbstractBackendSession
- implements HbaseSession<RowIterator> {
+ implements HbaseSession<RowIterator> {
private final Map<String, List<Row>> batch;
@@ -485,7 +483,7 @@ public class HbaseSessions extends BackendSessionPool {
}
private void checkBatchResults(Object[] results, List<Row> rows)
- throws Throwable {
+ throws Throwable {
assert rows.size() == results.length;
for (int i = 0; i < results.length; i++) {
Object result = results[i];
@@ -554,7 +552,7 @@ public class HbaseSessions extends BackendSessionPool {
} catch (Throwable e) {
// TODO: Mark and delete committed records
throw new BackendException("Failed to commit, " +
- "there may be inconsistent states for HBase", e);
+ "there may be inconsistent
states for HBase", e);
}
}
@@ -809,7 +807,7 @@ public class HbaseSessions extends BackendSessionPool {
byte[] key = CellUtil.cloneQualifier(cell);
byte[] val = CellUtil.cloneValue(cell);
LOG.info(" {}={}", StringEncoding.format(key),
- StringEncoding.format(val));
+ StringEncoding.format(val));
}
}
}
diff --git
a/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseStore.java
b/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseStore.java
index 9cd5c233a..7256dd830 100644
---
a/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseStore.java
+++
b/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseStore.java
@@ -440,7 +440,7 @@ public abstract class HbaseStore extends
AbstractBackendStore<Session> {
session.rollback();
}
- private final void checkConnectionOpened() {
+ private void checkConnectionOpened() {
E.checkState(this.sessions != null && this.sessions.opened(),
"HBase store has not been initialized");
}
diff --git
a/hugegraph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBSessions.java
b/hugegraph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBSessions.java
index 2d56a35a0..ad74bc6ab 100644
---
a/hugegraph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBSessions.java
+++
b/hugegraph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBSessions.java
@@ -133,6 +133,6 @@ public abstract class RocksDBSessions extends
BackendSessionPool {
public interface Countable {
- public long count();
+ long count();
}
}
diff --git
a/hugegraph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStore.java
b/hugegraph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStore.java
index 467d4c461..c55d92e33 100644
---
a/hugegraph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStore.java
+++
b/hugegraph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStore.java
@@ -797,13 +797,13 @@ public abstract class RocksDBStore extends
AbstractBackendStore<Session> {
}
}
- private final void useSessions() {
+ private void useSessions() {
for (RocksDBSessions sessions : this.sessions()) {
sessions.useSession();
}
}
- private final void closeSessions() {
+ private void closeSessions() {
Iterator<Map.Entry<String, RocksDBSessions>> iter = this.dbs.entrySet()
.iterator();
while (iter.hasNext()) {
@@ -816,7 +816,7 @@ public abstract class RocksDBStore extends
AbstractBackendStore<Session> {
}
}
- private final List<Session> session() {
+ private List<Session> session() {
this.checkOpened();
if (this.tableDiskMapping.isEmpty()) {
@@ -832,12 +832,13 @@ public abstract class RocksDBStore extends
AbstractBackendStore<Session> {
return list;
}
- private final Collection<RocksDBSessions> sessions() {
+ private Collection<RocksDBSessions> sessions() {
return this.dbs.values();
}
- private final void parseTableDiskMapping(Map<String, String> disks,
- String dataPath) {
+ private void parseTableDiskMapping(Map<String, String> disks,
+ String dataPath) {
+
this.tableDiskMapping.clear();
for (Map.Entry<String, String> disk : disks.entrySet()) {
// The format of `disk` like: `graph/vertex: /path/to/disk1`
@@ -884,7 +885,7 @@ public abstract class RocksDBStore extends
AbstractBackendStore<Session> {
return diskTableKey;
}
- private final void checkDbOpened() {
+ private void checkDbOpened() {
E.checkState(this.sessions != null && !this.sessions.closed(),
"RocksDB has not been opened");
}
diff --git
a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/UnitTestSuite.java
b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/UnitTestSuite.java
index fe8f0d14d..c95aaf600 100644
--- a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/UnitTestSuite.java
+++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/UnitTestSuite.java
@@ -66,7 +66,6 @@ import
com.baidu.hugegraph.unit.serializer.TableBackendEntryTest;
import com.baidu.hugegraph.unit.serializer.TextBackendEntryTest;
import com.baidu.hugegraph.unit.util.CompressUtilTest;
import com.baidu.hugegraph.unit.util.JsonUtilTest;
-import com.baidu.hugegraph.unit.util.RateLimiterTest;
import com.baidu.hugegraph.unit.util.StringEncodingTest;
import com.baidu.hugegraph.unit.util.VersionTest;
import com.baidu.hugegraph.unit.util.collection.CollectionFactoryTest;
diff --git a/style/checkstyle.xml b/style/checkstyle.xml
index f584e130c..eec890ec2 100644
--- a/style/checkstyle.xml
+++ b/style/checkstyle.xml
@@ -52,6 +52,10 @@
<!-- </module>-->
<module name="AvoidStarImport"/>
<module name="RedundantImport"/>
+ <module name="RedundantModifier">
+ <property name="tokens"
+
value="METHOD_DEF,VARIABLE_DEF,ANNOTATION_FIELD_DEF,INTERFACE_DEF,CLASS_DEF,ENUM_DEF,RESOURCE"/>
+ </module>
<module name="UnusedImports"/>
<module name="EmptyLineSeparator">
<property name="allowMultipleEmptyLines" value="false"/>
@@ -214,7 +218,6 @@
</module>
<module name="OneStatementPerLine"/>
<module name="MultipleVariableDeclarations"/>
- <module name="MissingSwitchDefault"/>
<module name="FallThrough"/>
<module name="OuterTypeFilename">
<!-- <property name="severity" value="error"/>-->