use of com.twitter.heron.common.basics.NIOLooper in project heron by twitter.
the class ConnectTest method before.
@Before
public void before() throws Exception {
UnitTestHelper.addSystemConfigToSingleton();
nioLooper = new NIOLooper();
slaveLooper = new SlaveLooper();
inStreamQueue = new Communicator<HeronTuples.HeronTupleSet>(nioLooper, slaveLooper);
inStreamQueue.init(Constants.QUEUE_BUFFER_SIZE, Constants.QUEUE_BUFFER_SIZE, 0.5);
outStreamQueue = new Communicator<HeronTuples.HeronTupleSet>(slaveLooper, nioLooper);
outStreamQueue.init(Constants.QUEUE_BUFFER_SIZE, Constants.QUEUE_BUFFER_SIZE, 0.5);
inControlQueue = new Communicator<InstanceControlMsg>(nioLooper, slaveLooper);
gatewayMetrics = new GatewayMetrics();
threadsPool = Executors.newSingleThreadExecutor();
// Get an available port
serverPort = SysUtils.getFreePort();
}
use of com.twitter.heron.common.basics.NIOLooper in project heron by twitter.
the class HandleReadTest method before.
@Before
public void before() throws Exception {
UnitTestHelper.addSystemConfigToSingleton();
nioLooper = new NIOLooper();
slaveLooper = new SlaveLooper();
inStreamQueue = new Communicator<HeronTuples.HeronTupleSet>(nioLooper, slaveLooper);
inStreamQueue.init(Constants.QUEUE_BUFFER_SIZE, Constants.QUEUE_BUFFER_SIZE, 0.5);
outStreamQueue = new Communicator<HeronTuples.HeronTupleSet>(slaveLooper, nioLooper);
outStreamQueue.init(Constants.QUEUE_BUFFER_SIZE, Constants.QUEUE_BUFFER_SIZE, 0.5);
inControlQueue = new Communicator<InstanceControlMsg>(nioLooper, slaveLooper);
gatewayMetrics = new GatewayMetrics();
threadsPool = Executors.newSingleThreadExecutor();
// Get an available port
serverPort = SysUtils.getFreePort();
}
use of com.twitter.heron.common.basics.NIOLooper in project heron by twitter.
the class HeronServerTest method before.
@Before
public void before() throws Exception {
// Get an available port
serverPort = SysUtils.getFreePort();
serverLooper = new NIOLooper();
heronServer = new SimpleHeronServer(serverLooper, SERVER_HOST, serverPort);
clientLooper = new NIOLooper();
heronClient = new SimpleHeronClient(clientLooper, SERVER_HOST, serverPort);
threadsPool = Executors.newFixedThreadPool(2);
}
use of com.twitter.heron.common.basics.NIOLooper in project heron by twitter.
the class HandleTMasterLocationTest method before.
@Before
public void before() throws Exception {
// Get an available port
serverPort = SysUtils.getFreePort();
threadsPool = Executors.newFixedThreadPool(2);
HeronSocketOptions serverSocketOptions = new HeronSocketOptions(100 * 1024 * 1024, 100, 100 * 1024 * 1024, 100, 5 * 1024 * 1024, 5 * 1024 * 1024);
serverLooper = new NIOLooper();
// Spy it for unit test
metricsManagerServer = Mockito.spy(new MetricsManagerServer(serverLooper, SERVER_HOST, serverPort, serverSocketOptions, new MultiCountMetric()));
}
use of com.twitter.heron.common.basics.NIOLooper in project heron by twitter.
the class HandleTMasterLocationTest method runClient.
private void runClient() {
Runnable runClient = new Runnable() {
private NIOLooper looper;
@Override
public void run() {
try {
looper = new NIOLooper();
simpleLocationPublisher = new SimpleTMasterLocationPublisher(looper, SERVER_HOST, serverPort);
simpleLocationPublisher.start();
looper.loop();
} catch (IOException e) {
throw new RuntimeException("Some error instantiating client");
} finally {
simpleLocationPublisher.stop();
if (looper != null) {
looper.exitLoop();
}
}
}
};
threadsPool.execute(runClient);
}
Aggregations