More checkstyle cleaning.

Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/a9611ef7
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/a9611ef7
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/a9611ef7

Branch: refs/heads/master
Commit: a9611ef74a905cfe0f60cade12c55fb3fe6269d8
Parents: 9f621e5
Author: Kyle Nusbaum <[email protected]>
Authored: Wed Jul 19 12:04:09 2017 -0500
Committer: Kyle Nusbaum <[email protected]>
Committed: Wed Jul 19 12:04:09 2017 -0500

----------------------------------------------------------------------
 .../org/apache/storm/pacemaker/PacemakerClient.java  |  6 ++----
 .../apache/storm/pacemaker/codec/ThriftDecoder.java  | 15 +++++++++++----
 .../pacemaker/codec/ThriftNettyClientCodec.java      |  9 +++++----
 .../org/apache/storm/pacemaker/PacemakerServer.java  |  4 +++-
 .../pacemaker/codec/ThriftNettyServerCodec.java      |  7 ++++---
 5 files changed, 25 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/a9611ef7/storm-client/src/jvm/org/apache/storm/pacemaker/PacemakerClient.java
----------------------------------------------------------------------
diff --git 
a/storm-client/src/jvm/org/apache/storm/pacemaker/PacemakerClient.java 
b/storm-client/src/jvm/org/apache/storm/pacemaker/PacemakerClient.java
index 33535a2..c43bd16 100644
--- a/storm-client/src/jvm/org/apache/storm/pacemaker/PacemakerClient.java
+++ b/storm-client/src/jvm/org/apache/storm/pacemaker/PacemakerClient.java
@@ -117,11 +117,9 @@ public class PacemakerClient implements ISaslClient {
         bootstrap.setOption("keepAlive", true);
 
         remote_addr = new InetSocketAddress(host, port);
-        int thriftMessageMaxSize =
-            (Integer) config.get(Config.PACEMAKER_THRIFT_MESSAGE_SIZE_MAX);
+        int thriftMessageMaxSize = (Integer) 
config.get(Config.PACEMAKER_THRIFT_MESSAGE_SIZE_MAX);
         ChannelPipelineFactory pipelineFactory =
-            new ThriftNettyClientCodec(this, config, authMethod,
-                                       host, thriftMessageMaxSize)
+            new ThriftNettyClientCodec(this, config, authMethod, host, 
thriftMessageMaxSize)
             .pipelineFactory();
         bootstrap.setPipelineFactory(pipelineFactory);
         bootstrap.connect(remote_addr);

http://git-wip-us.apache.org/repos/asf/storm/blob/a9611ef7/storm-client/src/jvm/org/apache/storm/pacemaker/codec/ThriftDecoder.java
----------------------------------------------------------------------
diff --git 
a/storm-client/src/jvm/org/apache/storm/pacemaker/codec/ThriftDecoder.java 
b/storm-client/src/jvm/org/apache/storm/pacemaker/codec/ThriftDecoder.java
index c9d7bc3..9e37ffb 100644
--- a/storm-client/src/jvm/org/apache/storm/pacemaker/codec/ThriftDecoder.java
+++ b/storm-client/src/jvm/org/apache/storm/pacemaker/codec/ThriftDecoder.java
@@ -32,10 +32,18 @@ public class ThriftDecoder extends FrameDecoder {
 
     private static final int INTEGER_SIZE = 4;
 
-    private int maxLength;
+    /**
+     * The maximum length in bytes that a serialized thrift message is allowed
+     * to be.
+     */
+    private final int maxLength;
 
-    public ThriftDecoder(int maxLength) {
-        this.maxLength = maxLength;
+    /**
+     * Instantiate a ThriftDecoder that accepts serialized messages of at most
+     * maxLength bytes.
+     */
+    public ThriftDecoder(final int maxLengthBytes) {
+        maxLength = maxLengthBytes;
     }
 
     @Override
@@ -49,7 +57,6 @@ public class ThriftDecoder extends FrameDecoder {
         buf.markReaderIndex();
 
         int thriftLen = buf.readInt();
-
         if (thriftLen < 0 || thriftLen > maxLength) {
             throw new IOException("Thrift message of length " + 
Integer.toString(thriftLen)
                                   + " is greater than allowed " + maxLength

http://git-wip-us.apache.org/repos/asf/storm/blob/a9611ef7/storm-client/src/jvm/org/apache/storm/pacemaker/codec/ThriftNettyClientCodec.java
----------------------------------------------------------------------
diff --git 
a/storm-client/src/jvm/org/apache/storm/pacemaker/codec/ThriftNettyClientCodec.java
 
b/storm-client/src/jvm/org/apache/storm/pacemaker/codec/ThriftNettyClientCodec.java
index dbe4a5d..811a72f 100644
--- 
a/storm-client/src/jvm/org/apache/storm/pacemaker/codec/ThriftNettyClientCodec.java
+++ 
b/storm-client/src/jvm/org/apache/storm/pacemaker/codec/ThriftNettyClientCodec.java
@@ -48,14 +48,15 @@ public class ThriftNettyClientCodec {
     private AuthMethod authMethod;
     private Map<String, Object> topoConf;
     private String host;
-    private final int _thriftMessageMaxSize;
+    private final int thriftMessageMaxSize;
 
-    public ThriftNettyClientCodec(PacemakerClient pacemaker_client, 
Map<String, Object> topoConf, AuthMethod authMethod, String host, int 
thriftMessageMaxSize) {
+    public ThriftNettyClientCodec(PacemakerClient pacemaker_client, 
Map<String, Object> topoConf,
+                                  AuthMethod authMethod, String host, int 
thriftMessageMaxSizeBytes) {
         client = pacemaker_client;
         this.authMethod = authMethod;
         this.topoConf = topoConf;
         this.host = host;
-        _thriftMessageMaxSize = thriftMessageMaxSize;
+        thriftMessageMaxSize = thriftMessageMaxSizeBytes;
     }
 
     public ChannelPipelineFactory pipelineFactory() {
@@ -63,7 +64,7 @@ public class ThriftNettyClientCodec {
             public ChannelPipeline getPipeline() {
                 ChannelPipeline pipeline = Channels.pipeline();
                 pipeline.addLast("encoder", new ThriftEncoder());
-                pipeline.addLast("decoder", new 
ThriftDecoder(_thriftMessageMaxSize));
+                pipeline.addLast("decoder", new 
ThriftDecoder(thriftMessageMaxSize));
 
                 if (authMethod == AuthMethod.KERBEROS) {
                     try {

http://git-wip-us.apache.org/repos/asf/storm/blob/a9611ef7/storm-server/src/main/java/org/apache/storm/pacemaker/PacemakerServer.java
----------------------------------------------------------------------
diff --git 
a/storm-server/src/main/java/org/apache/storm/pacemaker/PacemakerServer.java 
b/storm-server/src/main/java/org/apache/storm/pacemaker/PacemakerServer.java
index 5a68ac8..2f050db 100644
--- a/storm-server/src/main/java/org/apache/storm/pacemaker/PacemakerServer.java
+++ b/storm-server/src/main/java/org/apache/storm/pacemaker/PacemakerServer.java
@@ -107,7 +107,9 @@ class PacemakerServer implements ISaslServer {
         bootstrap.setOption("sendBufferSize", FIVE_MB_IN_BYTES);
         bootstrap.setOption("keepAlive", true);
         int thriftMessageMaxSize = 
(Integer)config.get(Config.PACEMAKER_THRIFT_MESSAGE_SIZE_MAX);
-        ChannelPipelineFactory pipelineFactory = new 
ThriftNettyServerCodec(this, config, authMethod, 
thriftMessageMaxSize).pipelineFactory();
+        ChannelPipelineFactory pipelineFactory =
+            new ThriftNettyServerCodec(this, config, authMethod, 
thriftMessageMaxSize)
+            .pipelineFactory();
         bootstrap.setPipelineFactory(pipelineFactory);
         Channel channel = bootstrap.bind(new InetSocketAddress(port));
         allChannels.add(channel);

http://git-wip-us.apache.org/repos/asf/storm/blob/a9611ef7/storm-server/src/main/java/org/apache/storm/pacemaker/codec/ThriftNettyServerCodec.java
----------------------------------------------------------------------
diff --git 
a/storm-server/src/main/java/org/apache/storm/pacemaker/codec/ThriftNettyServerCodec.java
 
b/storm-server/src/main/java/org/apache/storm/pacemaker/codec/ThriftNettyServerCodec.java
index 80e9c10..a6ceade 100644
--- 
a/storm-server/src/main/java/org/apache/storm/pacemaker/codec/ThriftNettyServerCodec.java
+++ 
b/storm-server/src/main/java/org/apache/storm/pacemaker/codec/ThriftNettyServerCodec.java
@@ -47,16 +47,17 @@ public class ThriftNettyServerCodec {
     private IServer server;
     private AuthMethod authMethod;
     private Map<String, Object> topoConf;
-    private int thriftMessageMaxSize;
+    private final int thriftMessageMaxSize;
     
     private static final Logger LOG = LoggerFactory
         .getLogger(ThriftNettyServerCodec.class);
 
-    public ThriftNettyServerCodec(IServer server, Map<String, Object> 
topoConf, AuthMethod authMethod, int thriftMessageMaxSize) {
+    public ThriftNettyServerCodec(IServer server, Map<String, Object> topoConf,
+                                  AuthMethod authMethod, int 
thriftMessageMaxSizeBytes) {
         this.server = server;
         this.authMethod = authMethod;
         this.topoConf = topoConf;
-        this.thriftMessageMaxSize = thriftMessageMaxSize;
+        thriftMessageMaxSize = thriftMessageMaxSizeBytes;
     }
 
     public ChannelPipelineFactory pipelineFactory() {

Reply via email to