You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by sz...@apache.org on 2019/02/16 17:10:21 UTC

[incubator-ratis] branch master updated: RATIS-411. Remove "public" from ServerProtoUtils. Contributed by Ritesh

This is an automated email from the ASF dual-hosted git repository.

szetszwo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ratis.git


The following commit(s) were added to refs/heads/master by this push:
     new 29921d2  RATIS-411. Remove "public" from ServerProtoUtils.  Contributed by Ritesh
29921d2 is described below

commit 29921d2840aa887f55ae650c544147dd8f60fedd
Author: Tsz Wo Nicholas Sze <sz...@apache.org>
AuthorDate: Sun Feb 17 01:09:10 2019 +0800

    RATIS-411. Remove "public" from ServerProtoUtils.  Contributed by Ritesh
---
 .../main/java/org/apache/ratis/util/NetUtils.java  | 10 ++++-----
 .../apache/ratis/server/impl/ServerProtoUtils.java | 24 +++++++++++-----------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/ratis-common/src/main/java/org/apache/ratis/util/NetUtils.java b/ratis-common/src/main/java/org/apache/ratis/util/NetUtils.java
index 9d97f4d..f81a1dc 100644
--- a/ratis-common/src/main/java/org/apache/ratis/util/NetUtils.java
+++ b/ratis-common/src/main/java/org/apache/ratis/util/NetUtils.java
@@ -27,9 +27,9 @@ import java.util.Objects;
 import java.util.concurrent.ConcurrentHashMap;
 
 public interface NetUtils {
-  public static final Logger LOG = LoggerFactory.getLogger(NetUtils.class);
+  Logger LOG = LoggerFactory.getLogger(NetUtils.class);
 
-  public static abstract class StaticResolution {
+  abstract class StaticResolution {
     /** Host -> resolved name */
     private static final Map<String, String> hostToResolved = new ConcurrentHashMap<>();
 
@@ -45,7 +45,7 @@ public interface NetUtils {
   }
 
   /** The same as createSocketAddr(target, -1). */
-  public static InetSocketAddress createSocketAddr(String target) {
+  static InetSocketAddress createSocketAddr(String target) {
     return createSocketAddr(target, -1);
   }
 
@@ -93,7 +93,7 @@ public interface NetUtils {
    * @param port the port number
    * @return InetSocketAddress
    */
-  public static InetSocketAddress createSocketAddrForHost(String host, int port) {
+  static InetSocketAddress createSocketAddrForHost(String host, int port) {
     String staticHost = StaticResolution.get(host);
     String resolveHost = (staticHost != null) ? staticHost : host;
 
@@ -112,7 +112,7 @@ public interface NetUtils {
     return addr;
   }
 
-  public static InetSocketAddress createLocalServerAddress() {
+  static InetSocketAddress createLocalServerAddress() {
     try(final ServerSocket s = new ServerSocket()) {
       s.setReuseAddress(true);
       s.bind(null);
diff --git a/ratis-server/src/main/java/org/apache/ratis/server/impl/ServerProtoUtils.java b/ratis-server/src/main/java/org/apache/ratis/server/impl/ServerProtoUtils.java
index bfec9b4..512fd18 100644
--- a/ratis-server/src/main/java/org/apache/ratis/server/impl/ServerProtoUtils.java
+++ b/ratis-server/src/main/java/org/apache/ratis/server/impl/ServerProtoUtils.java
@@ -41,23 +41,23 @@ import static org.apache.ratis.server.impl.RaftServerConstants.DEFAULT_SEQNUM;
 
 /** Server proto utilities for internal use. */
 public interface ServerProtoUtils {
-  public static TermIndex toTermIndex(TermIndexProto p) {
+  static TermIndex toTermIndex(TermIndexProto p) {
     return p == null? null: TermIndex.newTermIndex(p.getTerm(), p.getIndex());
   }
 
-  public static TermIndexProto toTermIndexProto(TermIndex ti) {
+  static TermIndexProto toTermIndexProto(TermIndex ti) {
     return ti == null? null: TermIndexProto.newBuilder()
         .setTerm(ti.getTerm())
         .setIndex(ti.getIndex())
         .build();
   }
 
-  public static TermIndex toTermIndex(LogEntryProto entry) {
+  static TermIndex toTermIndex(LogEntryProto entry) {
     return entry == null ? null :
         TermIndex.newTermIndex(entry.getTerm(), entry.getIndex());
   }
 
-  public static String toTermIndexString(LogEntryProto entry) {
+  static String toTermIndexString(LogEntryProto entry) {
     return TermIndex.toString(entry.getTerm(), entry.getIndex());
   }
 
@@ -79,7 +79,7 @@ public interface ServerProtoUtils {
     return toTermIndexString(entry) + ", " + entry.getLogEntryBodyCase() + s;
   }
 
-  public static String toString(LogEntryProto... entries) {
+  static String toString(LogEntryProto... entries) {
     return entries == null? "null"
         : entries.length == 0 ? "[]"
         : entries.length == 1? toLogEntryString(entries[0])
@@ -87,7 +87,7 @@ public interface ServerProtoUtils {
             .collect(Collectors.toList());
   }
 
-  public static String toString(AppendEntriesReplyProto reply) {
+  static String toString(AppendEntriesReplyProto reply) {
     return toString(reply.getServerReply()) + "," + reply.getResult()
         + ",nextIndex:" + reply.getNextIndex() + ",term:" + reply.getTerm()
         + ",followerCommit:" + reply.getFollowerCommit();
@@ -234,7 +234,7 @@ public interface ServerProtoUtils {
         requestorId.toByteString(), replyId.toByteString(), groupId, DEFAULT_CALLID, success);
   }
 
-  public static RequestVoteReplyProto toRequestVoteReplyProto(
+  static RequestVoteReplyProto toRequestVoteReplyProto(
       RaftPeerId requestorId, RaftPeerId replyId, RaftGroupId groupId,
       boolean success, long term, boolean shouldShutdown) {
     return RequestVoteReplyProto.newBuilder()
@@ -250,7 +250,7 @@ public interface ServerProtoUtils {
         requestorId.toByteString(), replyId.toByteString(), groupId, DEFAULT_CALLID, DEFAULT_SEQNUM);
   }
 
-  public static RequestVoteRequestProto toRequestVoteRequestProto(
+  static RequestVoteRequestProto toRequestVoteRequestProto(
       RaftPeerId requestorId, RaftPeerId replyId, RaftGroupId groupId, long term, TermIndex lastEntry) {
     final RequestVoteRequestProto.Builder b = RequestVoteRequestProto.newBuilder()
         .setServerRequest(toRaftRpcRequestProtoBuilder(requestorId, replyId, groupId))
@@ -261,7 +261,7 @@ public interface ServerProtoUtils {
     return b.build();
   }
 
-  public static InstallSnapshotReplyProto toInstallSnapshotReplyProto(
+  static InstallSnapshotReplyProto toInstallSnapshotReplyProto(
       RaftPeerId requestorId, RaftPeerId replyId, RaftGroupId groupId,
       long term, int requestIndex, InstallSnapshotResult result) {
     final RaftRpcReplyProto.Builder rb = toRaftRpcReplyProtoBuilder(requestorId,
@@ -272,7 +272,7 @@ public interface ServerProtoUtils {
     return builder.build();
   }
 
-  public static InstallSnapshotRequestProto toInstallSnapshotRequestProto(
+  static InstallSnapshotRequestProto toInstallSnapshotRequestProto(
       RaftPeerId requestorId, RaftPeerId replyId, RaftGroupId groupId, String requestId, int requestIndex,
       long term, TermIndex lastTermIndex, List<FileChunkProto> chunks,
       long totalSize, boolean done) {
@@ -288,7 +288,7 @@ public interface ServerProtoUtils {
         .setDone(done).build();
   }
 
-  public static AppendEntriesReplyProto toAppendEntriesReplyProto(
+  static AppendEntriesReplyProto toAppendEntriesReplyProto(
       RaftPeerId requestorId, RaftPeerId replyId, RaftGroupId groupId, long term,
       long followerCommit, long nextIndex, AppendResult result, long callId) {
     RaftRpcReplyProto.Builder rpcReply = toRaftRpcReplyProtoBuilder(
@@ -302,7 +302,7 @@ public interface ServerProtoUtils {
         .setResult(result).build();
   }
 
-  public static AppendEntriesRequestProto toAppendEntriesRequestProto(
+  static AppendEntriesRequestProto toAppendEntriesRequestProto(
       RaftPeerId requestorId, RaftPeerId replyId, RaftGroupId groupId, long leaderTerm,
       List<LogEntryProto> entries, long leaderCommit, boolean initializing,
       TermIndex previous, Collection<CommitInfoProto> commitInfos, long callId) {