THRIFT-957. java: THsHaServer: Change access modifier of the invoker field.
authorBryan Duxbury <bryanduxbury@apache.org>
Tue, 19 Oct 2010 18:06:45 +0000 (18:06 +0000)
committerBryan Duxbury <bryanduxbury@apache.org>
Tue, 19 Oct 2010 18:06:45 +0000 (18:06 +0000)
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

lib/java/src/org/apache/thrift/server/THsHaServer.java

index acc3da1..207d8e8 100644 (file)
@@ -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