ducin
ducin

Reputation: 26437

thrift java server - how to configure threads

I've got a following code that starts a thrift java server:

public class Server {

    public static void StartsimpleServer(GameService.Processor<GameServiceHandler> processor) {
        try {
            TServerTransport serverTransport = new TServerSocket(9090);
            TServer server = new TThreadPoolServer(new
              TThreadPoolServer.Args(serverTransport).processor(processor));

            System.out.println("Starting the multi thread server...");
            server.serve();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        StartsimpleServer(new GameService.Processor<>( new GameServiceHandler()));
    }
}

I would like to set the number of maximum threads and other thread-related settings. How can I do that? I couldn't find any documentation concerning that.

Upvotes: 0

Views: 1746

Answers (1)

darijan
darijan

Reputation: 9775

Is this what you are looking for:

TThreadPoolServer.Args a = new TThreadPoolServer.Args(serverTransport).processor(processor);
a.maxWorkerThreads(5);

Upvotes: 1

Related Questions