Skip to content

Instantly share code, notes, and snippets.

@dcapwell
Created November 25, 2014 04:53
Show Gist options
  • Save dcapwell/815046e22c1bd4e0cd48 to your computer and use it in GitHub Desktop.
Save dcapwell/815046e22c1bd4e0cd48 to your computer and use it in GitHub Desktop.
package tach_demo;
import java.net.InetSocketAddress;
import tachyon.org.apache.thrift.TProcessor;
import tachyon.org.apache.thrift.server.TServer;
import tachyon.org.apache.thrift.server.TThreadedSelectorServer;
import tachyon.org.apache.thrift.transport.TNonblockingServerSocket;
import tachyon.org.apache.thrift.transport.TTransportException;
import tachyon.master.MasterServiceHandler;
import tachyon.thrift.MasterService;
public class TachyonHelper {
private TachyonHelper() {};
public static TServer createServer() throws Exception {
return new TThreadedSelectorServer(args());
}
private static TThreadedSelectorServer.Args args() throws Exception {
MasterService.Processor<MasterServiceHandler> p =
//TProcessor p =
new MasterService.Processor<MasterServiceHandler>(new MasterServiceHandler(null));
InetSocketAddress address = new InetSocketAddress(12345);
return new TThreadedSelectorServer.Args(new TNonblockingServerSocket(address))
.processor(p)
.selectorThreads(10)
.acceptQueueSizePerThread(10)
.workerThreads(10);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment