Search in sources :

Example 1 with TTransportFactory

use of org.apache.thrift7.transport.TTransportFactory in project storm by nathanmarz.

the class SaslTransportPlugin method getServer.

public TServer getServer(int port, TProcessor processor) throws IOException, TTransportException {
    TTransportFactory serverTransportFactory = getServerTransportFactory();
    //define THsHaServer args 
    //original: THsHaServer + TNonblockingServerSocket
    //option: TThreadPoolServer + TServerSocket
    TServerSocket serverTransport = new TServerSocket(port);
    TThreadPoolServer.Args server_args = new TThreadPoolServer.Args(serverTransport).processor(new TUGIWrapProcessor(processor)).minWorkerThreads(64).maxWorkerThreads(64).protocolFactory(new TBinaryProtocol.Factory());
    if (serverTransportFactory != null)
        server_args.transportFactory(serverTransportFactory);
    //construct THsHaServer
    return new TThreadPoolServer(server_args);
}
Also used : TServerSocket(org.apache.thrift7.transport.TServerSocket) TBinaryProtocol(org.apache.thrift7.protocol.TBinaryProtocol) TTransportFactory(org.apache.thrift7.transport.TTransportFactory) TThreadPoolServer(org.apache.thrift7.server.TThreadPoolServer)

Example 2 with TTransportFactory

use of org.apache.thrift7.transport.TTransportFactory in project storm by nathanmarz.

the class DigestSaslTransportPlugin method getServerTransportFactory.

protected TTransportFactory getServerTransportFactory() throws IOException {
    //create an authentication callback handler
    CallbackHandler serer_callback_handler = new ServerCallbackHandler(login_conf);
    //create a transport factory that will invoke our auth callback for digest
    TSaslServerTransport.Factory factory = new TSaslServerTransport.Factory();
    factory.addServerDefinition(DIGEST, AuthUtils.SERVICE, "localhost", null, serer_callback_handler);
    LOG.info("SASL DIGEST-MD5 transport factory will be used");
    return factory;
}
Also used : TSaslServerTransport(org.apache.thrift7.transport.TSaslServerTransport) CallbackHandler(javax.security.auth.callback.CallbackHandler) LoggerFactory(org.slf4j.LoggerFactory) TTransportFactory(org.apache.thrift7.transport.TTransportFactory)

Aggregations

TTransportFactory (org.apache.thrift7.transport.TTransportFactory)2 CallbackHandler (javax.security.auth.callback.CallbackHandler)1 TBinaryProtocol (org.apache.thrift7.protocol.TBinaryProtocol)1 TThreadPoolServer (org.apache.thrift7.server.TThreadPoolServer)1 TSaslServerTransport (org.apache.thrift7.transport.TSaslServerTransport)1 TServerSocket (org.apache.thrift7.transport.TServerSocket)1 LoggerFactory (org.slf4j.LoggerFactory)1