thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Napolitano, Diane" <dnapolit...@ets.org>
Subject Question about Multithreaded Thrift Servers
Date Fri, 05 Apr 2013 19:43:57 GMT
Hello, I have a Thrift server (just "NameOfServer" here) written in Java which is initialized
with the following inside of an inner class called ServerThread:

TThreadPoolServer.Args args = new TThreadPoolServer.Args(serverTransport);
args.maxWorkerThreads(10);
args.processor(processor);
TServer server = new TThreadPoolServer(args);
server.serve();

Then NameOfServer has two objects:
public static NameOfServerHandler handler;
public static NameOfServer.Processor processor;

And then a ServerThread object is created in my server's main:
handler = new NameOfServerHandler();
processor = new NameOfServer.Processor(handler);
Runnable r = new ServerThread(processor, portNum);
new Thread(r).start();

My question is: am I doing this right?  Because when I send more than ten requests to the
server, it throws an exception and dies, and all requests beyond the first 10 are stalled.
 Unless I'm misunderstanding threads, Java, and everything else, aren't these additional requests
supposed to be queued and then served when one of the 10 threads becomes available?

If you need more code/context than this, definitely let me know.

Thanks,
Diane

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message