bookkeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eolive...@apache.org
Subject bookkeeper git commit: BOOKKEEPER-1071: Use per connection instances of request encoder/decoder
Date Thu, 01 Jun 2017 07:47:33 GMT
Repository: bookkeeper
Updated Branches:
  refs/heads/master fc51f73cb -> da7064871


BOOKKEEPER-1071: Use per connection instances of request encoder/decoder

Author: Matteo Merli <mmerli@yahoo-inc.com>

Reviewers: Enrico Olivelli, Sijie Guo

Closes #170 from merlimat/bk-1071


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

Branch: refs/heads/master
Commit: da70648719679fd1db001c74ad873bf134f16198
Parents: fc51f73
Author: Matteo Merli <mmerli@yahoo-inc.com>
Authored: Thu Jun 1 09:47:28 2017 +0200
Committer: Enrico Olivelli <eolivelli@apache.org>
Committed: Thu Jun 1 09:47:28 2017 +0200

----------------------------------------------------------------------
 .../bookkeeper/proto/BookieNettyServer.java       | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/da706487/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieNettyServer.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieNettyServer.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieNettyServer.java
index cf7d419..53fd334 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieNettyServer.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieNettyServer.java
@@ -91,20 +91,14 @@ class BookieNettyServer {
     final BookieSocketAddress bookieAddress;
 
     final BookieAuthProvider.Factory authProviderFactory;
-    final BookieProtoEncoding.ResponseEncoder responseEncoder;
-    final BookieProtoEncoding.RequestDecoder requestDecoder;
+    final ExtensionRegistry registry = ExtensionRegistry.newInstance();
 
     BookieNettyServer(ServerConfiguration conf, RequestProcessor processor)
         throws IOException, KeeperException, InterruptedException, BookieException {
         this.maxFrameSize = conf.getNettyMaxFrameSizeBytes();
         this.conf = conf;
         this.requestProcessor = processor;
-
-        ExtensionRegistry registry = ExtensionRegistry.newInstance();
-        authProviderFactory = AuthProviderFactoryFactory.newBookieAuthProviderFactory(conf);
-
-        responseEncoder = new BookieProtoEncoding.ResponseEncoder(registry);
-        requestDecoder = new BookieProtoEncoding.RequestDecoder(registry);
+        this.authProviderFactory = AuthProviderFactoryFactory.newBookieAuthProviderFactory(conf);
 
         if (!conf.isDisableServerSocketBind()) {
             ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("bookie-io-%s").build();
@@ -212,8 +206,8 @@ class BookieNettyServer {
                     pipeline.addLast("lengthbaseddecoder", new LengthFieldBasedFrameDecoder(maxFrameSize,
0, 4, 0, 4));
                     pipeline.addLast("lengthprepender", new LengthFieldPrepender(4));
 
-                    pipeline.addLast("bookieProtoDecoder", requestDecoder);
-                    pipeline.addLast("bookieProtoEncoder", responseEncoder);
+                    pipeline.addLast("bookieProtoDecoder", new BookieProtoEncoding.RequestDecoder(registry));
+                    pipeline.addLast("bookieProtoEncoder", new BookieProtoEncoding.ResponseEncoder(registry));
                     pipeline.addLast("bookieAuthHandler", new AuthHandler.ServerSideHandler(contextHandler.getConnectionPeer(),
authProviderFactory));
 
                     ChannelInboundHandler requestHandler = isRunning.get()
@@ -261,8 +255,8 @@ class BookieNettyServer {
                     pipeline.addLast("lengthbaseddecoder", new LengthFieldBasedFrameDecoder(maxFrameSize,
0, 4, 0, 4));
                     pipeline.addLast("lengthprepender", new LengthFieldPrepender(4));
 
-                    pipeline.addLast("bookieProtoDecoder", requestDecoder);
-                    pipeline.addLast("bookieProtoEncoder", responseEncoder);
+                    pipeline.addLast("bookieProtoDecoder", new BookieProtoEncoding.RequestDecoder(registry));
+                    pipeline.addLast("bookieProtoEncoder", new BookieProtoEncoding.ResponseEncoder(registry));;
                     pipeline.addLast("bookieAuthHandler", new AuthHandler.ServerSideHandler(contextHandler.getConnectionPeer(),
authProviderFactory));
 
                     ChannelInboundHandler requestHandler = isRunning.get()


Mime
View raw message