code: public static TServer createThreadedServer(TProcessorFactory processorFactory,
              TProtocolFactory protocolFactory, int port, int maxWorkerThreads,
              int clientTimeoutMillisecs, int maxFrameSize) throws TTransportException {
          if (maxWorkerThreads < 1) {
              maxWorkerThreads = Math.max(2, Runtime.getRuntime().availableProcessors());
          }
          TServerTransport transport = new TServerSocket(port, clientTimeoutMillisecs);
          TTransportFactory transportFactory = new TFramedTransport.Factory(maxFrameSize);
          TThreadPoolServer.Args args = new TThreadPoolServer.Args(transport)
                  .processorFactory(processorFactory).protocolFactory(protocolFactory)
                  .transportFactory(transportFactory).minWorkerThreads(1)
                  .maxWorkerThreads(maxWorkerThreads);
          TThreadPoolServer server = new TThreadPoolServer(args);
          return server;
      }
docs: Helper method to create a new framed-transport, threaded-{@link TServer}.
  
  <p>
  Note: if {@code maxWorkerThreads < 1}, the {@link TServer} is created
  with {@code maxWorkerThreads} =
  {@code Math.max(2, Runtime.getRuntime().availableProcessors())}
  </p>
  
  @param processorFactory
  @param protocolFactory
  @param port
  @param maxWorkerThreads
  @param clientTimeoutMillisecs
  @param maxFrameSize
  @return
  @throws TTransportException