use of com.twitter.heron.common.basics.NIOLooper in project heron by twitter.
the class EchoTest method runServer.
private void runServer() {
Runnable server = new Runnable() {
@Override
public void run() {
NIOLooper looper;
try {
looper = new NIOLooper();
EchoServer s = new EchoServer(looper, serverPort, 1000);
s.start();
} catch (IOException e) {
throw new RuntimeException("Some error instantiating server");
}
looper.loop();
}
};
threadsPool.execute(server);
}
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);
}
use of com.twitter.heron.common.basics.NIOLooper in project heron by twitter.
the class MetricsManagerServerTest method runClient.
private void runClient() {
Runnable runClient = new Runnable() {
@Override
public void run() {
try {
NIOLooper looper = new NIOLooper();
simpleMetricsClient = new SimpleMetricsClient(looper, SERVER_HOST, serverPort, MESSAGE_SIZE);
simpleMetricsClient.start();
looper.loop();
} catch (IOException e) {
throw new RuntimeException("Some error instantiating client");
} finally {
simpleMetricsClient.stop();
}
}
};
threadsPool.execute(runClient);
}
use of com.twitter.heron.common.basics.NIOLooper in project heron by twitter.
the class MetricsManagerServerTest 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();
metricsManagerServer = new MetricsManagerServer(serverLooper, SERVER_HOST, serverPort, serverSocketOptions, new MultiCountMetric());
}
Aggregations