From 6b801ed0c43df2fe9db1ff93ea9f11522eb1bc14 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 24 Feb 2023 16:56:25 +0100 Subject: [server] Add JSON/HTTP listener for thrift --- .../main/java/org/openslx/bwlp/sat/thrift/BinaryListener.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/BinaryListener.java') diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/BinaryListener.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/BinaryListener.java index 7cb6ef19..d730eace 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/BinaryListener.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/BinaryListener.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.security.NoSuchAlgorithmException; +import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; import javax.net.ssl.SSLContext; @@ -38,10 +39,10 @@ public class BinaryListener implements Runnable { private final TServer server; - public BinaryListener(int port, boolean secure) throws TTransportException, NoSuchAlgorithmException, - IOException { + public BinaryListener(int port, boolean secure, ExecutorService es) + throws TTransportException, NoSuchAlgorithmException, IOException { if (secure) - server = initSecure(port); + server = initSecure(port, es); else server = initNormal(port); } @@ -54,7 +55,7 @@ public class BinaryListener implements Runnable { // TODO: Restart listener; if it fails, quit server so it will be restarted by the OS } - private TServer initSecure(int port) throws NoSuchAlgorithmException, TTransportException, IOException { + private TServer initSecure(int port, ExecutorService es) throws NoSuchAlgorithmException, TTransportException, IOException { SSLContext context = Identity.getSSLContext(); if (context == null) return null; @@ -73,6 +74,7 @@ public class BinaryListener implements Runnable { TThreadPoolServer.Args args = new TThreadPoolServer.Args(serverTransport); args.protocolFactory(protFactory); args.processor(processor); + args.executorService(es); args.minWorkerThreads(MINWORKERTHREADS).maxWorkerThreads(MAXWORKERTHREADS); args.stopTimeoutVal(2).stopTimeoutUnit(TimeUnit.MINUTES); args.transportFactory(new TFastFramedTransport.Factory(MAX_MSG_LEN)); -- cgit v1.2.3-55-g7522