thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tenghuan He <>
Subject Different clients share same Handler when using ProcessorFactory
Date Sun, 26 Jun 2016 18:57:50 GMT
Hi everyone,

I am using Thrift to do some RPC.
In the server side, a ProcessorFacotry is used to create a new
Processor(Handler) for each coming client connection.
Then 250 clients thread were created to connect to the thrift server.
In *some cases*, there can be two clients sharing the same Handler.
For example, when there are 250 clients, 249 Handlers are created, and say
Handler39 served client29 and client88, other handlers and clients are
while all clients got *correct *results,
It seems that Handlers are reusable

I want to know
1. What's the correspondence  between client <->
transport/socket/connection <-> handler <-> processor, especially when
using ProcessorFactory?
2. is Handlers reusable when using ProcessorFactory?

Can anyone give some detailed explanation?

Here is the my server code:

public class DBServiceServer {
    private static final Logger log =
    private TServer server;
    private TServerSocket trans;
    private TProcessorFactory processorFactory;

    public DBServiceServer(int port) throws TTransportException {
        trans = new TServerSocket(port);
        processorFactory = new TProcessorFactory(null) {
            public TProcessor getProcessor(TTransport trans) {
                return new DBService.Processor<>(new DBServiceHandler());
        server = new TThreadPoolServer(new TThreadPoolServer.Args(trans)

    public void start() {

Thanks & Best Regards

Tenghuan He

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