use of org.apache.thrift.transport.TServerSocket in project tutorials by eugenp.
the class CrossPlatformServiceServer method start.
public void start() throws TTransportException {
TServerTransport serverTransport = new TServerSocket(9090);
server = new TSimpleServer(new TServer.Args(serverTransport).processor(new CrossPlatformService.Processor<>(new CrossPlatformServiceImpl())));
System.out.print("Starting the server... ");
server.serve();
System.out.println("done.");
}
use of org.apache.thrift.transport.TServerSocket in project jstorm by alibaba.
the class SaslTransportPlugin method getServer.
@Override
public TServer getServer(TProcessor processor) throws IOException, TTransportException {
int port = type.getPort(storm_conf);
TTransportFactory serverTransportFactory = getServerTransportFactory();
TServerSocket serverTransport = new TServerSocket(port);
int numWorkerThreads = type.getNumThreads(storm_conf);
Integer queueSize = type.getQueueSize(storm_conf);
TThreadPoolServer.Args server_args = new TThreadPoolServer.Args(serverTransport).processor(new TUGIWrapProcessor(processor)).minWorkerThreads(numWorkerThreads).maxWorkerThreads(numWorkerThreads).protocolFactory(new TBinaryProtocol.Factory(false, true));
if (serverTransportFactory != null) {
server_args.transportFactory(serverTransportFactory);
}
BlockingQueue workQueue = new SynchronousQueue();
if (queueSize != null) {
workQueue = new ArrayBlockingQueue(queueSize);
}
ThreadPoolExecutor executorService = new ExtendedThreadPoolExecutor(numWorkerThreads, numWorkerThreads, 60, TimeUnit.SECONDS, workQueue);
server_args.executorService(executorService);
return new TThreadPoolServer(server_args);
}
use of org.apache.thrift.transport.TServerSocket in project commons by twitter.
the class PingPongServer method run.
@Override
public void run() {
PingPongHandler handler = new PingPongHandler();
PingPong.Processor processor = new PingPong.Processor(handler);
TServer server;
try {
TServerTransport transport = new TServerSocket(THRIFT_PORT.get());
server = new TSimpleServer(processor, transport);
} catch (TTransportException e) {
throw new RuntimeException(e);
}
LOG.info("Starting thrift server.");
server.serve();
}
use of org.apache.thrift.transport.TServerSocket in project providence by morimekta.
the class SocketClientHandlerTest method setUpServer.
@BeforeClass
public static void setUpServer() throws Exception {
Awaitility.setDefaultPollDelay(2, TimeUnit.MILLISECONDS);
impl = Mockito.mock(Iface.class);
TServerSocket transport = new TServerSocket(0);
server = new TSimpleServer(new TServer.Args(transport).protocolFactory(new TBinaryProtocol.Factory()).processor(new Processor<>(impl)));
executor = Executors.newSingleThreadExecutor();
executor.submit(server::serve);
serializer = new BinarySerializer();
port = transport.getServerSocket().getLocalPort();
address = new InetSocketAddress("localhost", port);
}
use of org.apache.thrift.transport.TServerSocket in project zeppelin by apache.
the class RemoteInterpreterServer method run.
@Override
public void run() {
RemoteInterpreterService.Processor<RemoteInterpreterServer> processor = new RemoteInterpreterService.Processor<>(this);
try (TServerSocket tSocket = new TServerSocket(port)) {
server = new TThreadPoolServer(new TThreadPoolServer.Args(tSocket).stopTimeoutVal(DEFAULT_SHUTDOWN_TIMEOUT).stopTimeoutUnit(TimeUnit.MILLISECONDS).processor(processor));
if (null != intpEventServerHost && !isTest) {
Thread registerThread = new Thread(new RegisterRunnable());
registerThread.setName("RegisterThread");
registerThread.start();
}
LOGGER.info("Launching ThriftServer at {}:{}", this.host, this.port);
server.serve();
} catch (TTransportException e) {
LOGGER.error("Failure in TTransport", e);
}
LOGGER.info("RemoteInterpreterServer-Thread finished");
}
Aggregations