TServerTransport transport = new TServerSocket(port);
TTransportFactory transportFactory = new TFramedTransport.Factory();
TProtocolFactory protocolFactory = new TBinaryProtocol.Factory();
TProcessor processor = new RemoteServer.Processor(remoteImpl);
TServer server = new TThreadPoolServer(processor, transport, transportFactory,
protocolFactory);
LOG.info("Starting processing thread");
remoteImpl.setServer(server);
remoteImpl.start();
try {
LOG.info("Serving on port " + port);
server.serve();
} finally {
LOG.info("Shutting down processing thread");
if (remoteImpl.isRunning()) {
remoteImpl.shutdown();
}