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 acc3da1..207d8e8 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 @@
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 @@
@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 @@
}
}
+ 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