From: Bryan Duxbury Date: Tue, 19 Oct 2010 18:06:45 +0000 (+0000) Subject: THRIFT-957. java: THsHaServer: Change access modifier of the invoker field. X-Git-Tag: 0.6.0~66 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=2376684d86215e0ef1415f8820d9a2a797dcd3a0;p=common%2Fthrift.git THRIFT-957. java: THsHaServer: Change access modifier of the invoker field. This patch adds a new overridable method to allow subclasses to specify their own Runnable implementation. Patch: Benjamin Coverston git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1024343 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/java/src/org/apache/thrift/server/THsHaServer.java b/lib/java/src/org/apache/thrift/server/THsHaServer.java index acc3da12..207d8e8e 100644 --- a/lib/java/src/org/apache/thrift/server/THsHaServer.java +++ b/lib/java/src/org/apache/thrift/server/THsHaServer.java @@ -57,7 +57,7 @@ public class THsHaServer extends TNonblockingServer { TNonblockingServerTransport serverTransport) { this(processor, serverTransport, new Options()); } - + /** * Create server with given processor, server transport, and server options * using TBinaryProtocol for the protocol, and TFramedTransport.Factory on @@ -296,7 +296,8 @@ public class THsHaServer extends TNonblockingServer { @Override protected boolean requestInvoke(FrameBuffer frameBuffer) { try { - invoker.execute(new Invocation(frameBuffer)); + Runnable invocation = getRunnable(frameBuffer); + invoker.execute(invocation); return true; } catch (RejectedExecutionException rx) { LOGGER.warn("ExecutorService rejected execution!", rx); @@ -304,6 +305,10 @@ public class THsHaServer extends TNonblockingServer { } } + protected Runnable getRunnable(FrameBuffer frameBuffer){ + return new Invocation(frameBuffer); + } + /** * An Invocation represents a method call that is prepared to execute, given * an idle worker thread. It contains the input and output protocols the