diff options
author | Nils Schwabe | 2014-08-18 14:46:56 +0200 |
---|---|---|
committer | Nils Schwabe | 2014-08-18 14:46:56 +0200 |
commit | 81adbf5bf48f5ebd55d1ed6d2458e07016da22ad (patch) | |
tree | 22e5f932a99dc6d92c10698b63f642341caa7d0f | |
parent | Add testing database export (diff) | |
download | masterserver-81adbf5bf48f5ebd55d1ed6d2458e07016da22ad.tar.gz masterserver-81adbf5bf48f5ebd55d1ed6d2458e07016da22ad.tar.xz masterserver-81adbf5bf48f5ebd55d1ed6d2458e07016da22ad.zip |
Change TThreadPoolServer to THsHaServer and use TNonBlockingServerTransport
-rw-r--r-- | src/main/java/org/openslx/imagemaster/thrift/server/BinaryListener.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main/java/org/openslx/imagemaster/thrift/server/BinaryListener.java b/src/main/java/org/openslx/imagemaster/thrift/server/BinaryListener.java index 8eeb7bc..7d9c7f0 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/server/BinaryListener.java +++ b/src/main/java/org/openslx/imagemaster/thrift/server/BinaryListener.java @@ -2,13 +2,12 @@ package org.openslx.imagemaster.thrift.server; import org.apache.log4j.Logger; import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.server.THsHaServer; import org.apache.thrift.server.TServer; -import org.apache.thrift.server.TThreadPoolServer; -import org.apache.thrift.transport.TServerSocket; -import org.apache.thrift.transport.TServerTransport; +import org.apache.thrift.transport.TNonblockingServerSocket; +import org.apache.thrift.transport.TNonblockingServerTransport; import org.apache.thrift.transport.TTransportException; import org.openslx.imagemaster.thrift.iface.ImageServer; -import org.apache.thrift.server.TThreadPoolServer.Args; public class BinaryListener implements Runnable { @@ -20,15 +19,14 @@ public class BinaryListener implements Runnable final ImageServerHandler handler = new ImageServerHandler(); final ImageServer.Processor<ImageServerHandler> processor = new ImageServer.Processor<ImageServerHandler>( handler ); final TProtocolFactory protFactory = new TBinaryProtocolSafe.Factory( true, true ); - final TServerTransport transport; + final TNonblockingServerTransport transport; try { - transport = new TServerSocket( 9090 ); + transport = new TNonblockingServerSocket( 9090 ); } catch ( TTransportException e ) { log.fatal( "Could not listen on port 9090" ); return; } - TServer server = new TThreadPoolServer( new Args( transport ).protocolFactory( protFactory ).processor( processor ) - .minWorkerThreads( 4 ).maxWorkerThreads( 8 ) ); + TServer server = new THsHaServer( new THsHaServer.Args( transport ).protocolFactory( protFactory ).processor( processor ).workerThreads( 8 ) ); log.info( "Starting Binary Thrift" ); server.serve(); } |