accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1454002 - in /accumulo/branches/1.5: core/src/main/java/org/apache/accumulo/core/util/ThriftUtil.java server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java
Date Thu, 07 Mar 2013 19:00:43 GMT
Author: ecn
Date: Thu Mar  7 19:00:43 2013
New Revision: 1454002

URL: http://svn.apache.org/r1454002
Log:
ACCUMULO-1141 use maxFrameSize 

Modified:
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/ThriftUtil.java
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java

Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/ThriftUtil.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/ThriftUtil.java?rev=1454002&r1=1454001&r2=1454002&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/ThriftUtil.java
(original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/ThriftUtil.java
Thu Mar  7 19:00:43 2013
@@ -17,9 +17,9 @@
 package org.apache.accumulo.core.util;
 
 import java.net.InetSocketAddress;
+import java.util.HashMap;
+import java.util.Map;
 
-import org.apache.accumulo.trace.instrument.Span;
-import org.apache.accumulo.trace.instrument.Trace;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.impl.ClientExec;
@@ -29,6 +29,8 @@ import org.apache.accumulo.core.client.i
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
+import org.apache.accumulo.trace.instrument.Span;
+import org.apache.accumulo.trace.instrument.Trace;
 import org.apache.log4j.Logger;
 import org.apache.thrift.TException;
 import org.apache.thrift.TServiceClient;
@@ -166,6 +168,23 @@ public class ThriftUtil {
     return transportFactory;
   }
   
+  private final static Map<Integer,TTransportFactory> factoryCache = new HashMap<Integer,TTransportFactory>();
+  synchronized public static TTransportFactory transportFactory(int maxFrameSize) {
+    TTransportFactory factory = factoryCache.get(maxFrameSize);
+    if(factory == null)
+    {
+      factory = new TFramedTransport.Factory(maxFrameSize);
+      factoryCache.put(maxFrameSize,factory);
+    }
+    return factory;
+  }
+
+  synchronized public static TTransportFactory transportFactory(long maxFrameSize) {
+    if(maxFrameSize > Integer.MAX_VALUE || maxFrameSize < 1)
+      throw new RuntimeException("Thrift transport frames are limited to "+Integer.MAX_VALUE);
+    return transportFactory((int)maxFrameSize);
+  }
+
   public static TProtocolFactory protocolFactory() {
     return protocolFactory;
   }

Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java?rev=1454002&r1=1454001&r2=1454002&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java
(original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java
Thu Mar  7 19:00:43 2013
@@ -215,7 +215,7 @@ public class TServerUtils {
     TNonblockingServerSocket transport = new TNonblockingServerSocket(port);
     THsHaServer.Args options = new THsHaServer.Args(transport);
     options.protocolFactory(ThriftUtil.protocolFactory());
-    options.transportFactory(ThriftUtil.transportFactory());
+    options.transportFactory(ThriftUtil.transportFactory(maxMessageSize));
     /*
      * Create our own very special thread pool.
      */



Mime
View raw message