use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.
the class FiniteStateMachineTest method spawnActor.
private <T extends Actor<Message, V>, Message, V> T spawnActor(T actor) {
Fiber fiber = new Fiber(actor);
fiber.setUncaughtExceptionHandler(new Strand.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Strand s, Throwable e) {
e.printStackTrace();
throw Exceptions.rethrow(e);
}
});
fiber.start();
return actor;
}
use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.
the class ProxyServerTest method spawnActor.
private <T extends Actor<Message, V>, Message, V> T spawnActor(T actor) {
Fiber fiber = new Fiber(scheduler, actor);
fiber.setUncaughtExceptionHandler(new Strand.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Strand s, Throwable e) {
e.printStackTrace();
throw Exceptions.rethrow(e);
}
});
fiber.start();
return actor;
}
use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.
the class ServerTest method spawnActor.
private <T extends Actor<Message, V>, Message, V> T spawnActor(T actor) {
Fiber fiber = new Fiber(scheduler, actor);
fiber.setUncaughtExceptionHandler(new Strand.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Strand s, Throwable e) {
e.printStackTrace();
throw Exceptions.rethrow(e);
}
});
fiber.start();
return actor;
}
use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.
the class ActorTest method spawnActor.
private <Message, V> Actor<Message, V> spawnActor(Actor<Message, V> actor) {
Fiber fiber = new Fiber("actor", scheduler, actor);
fiber.setUncaughtExceptionHandler(new Strand.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Strand s, Throwable e) {
e.printStackTrace();
throw Exceptions.rethrow(e);
}
});
fiber.start();
return actor;
}
use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.
the class ChannelTest method sendMessageFromFiberToThread.
@Test
public void sendMessageFromFiberToThread() throws Exception {
final Channel<String> ch = newChannel();
Fiber fib = new Fiber("fiber", scheduler, new SuspendableRunnable() {
@Override
public void run() throws SuspendExecution, InterruptedException {
Fiber.sleep(100);
ch.send("a message");
}
}).start();
String m = ch.receive();
assertThat(m, equalTo("a message"));
fib.join();
}
Aggregations