use of co.paralleluniverse.strands.Strand in project quasar by puniverse.
the class EventSourceTest method spawnActor.
private <T extends Actor<Message, V>, Message, V> T spawnActor(T actor) {
final 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.strands.Strand 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.strands.Strand 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.strands.Strand 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.strands.Strand in project quasar by puniverse.
the class Actor method run0.
//</editor-fold>
//<editor-fold desc="Lifecycle">
/////////// Lifecycle ///////////////////////////////////
final V run0() throws InterruptedException, SuspendExecution {
JMXActorsMonitor.getInstance().actorStarted(ref);
// runner might be nulled by running actor
final Strand strand = runner.getStrand();
if (!strand.isFiber())
currentActor.set(this);
try {
if (this instanceof MigratingActor && globalId == null)
this.globalId = MigrationService.registerMigratingActor();
result = doRun();
die(null);
return result;
} catch (ActorAbort abort) {
throw abort;
} catch (InterruptedException e) {
if (this.exception != null) {
die(exception);
throw (RuntimeException) exception;
}
die(e);
throw e;
} catch (Throwable t) {
if (t.getCause() instanceof InterruptedException) {
InterruptedException ie = (InterruptedException) t.getCause();
if (this.exception != null) {
die(exception);
throw (RuntimeException) exception;
}
die(ie);
throw ie;
}
this.exception = t;
die(t);
throw t;
} finally {
record(1, "Actor", "die", "Actor %s is now dead of %s", this, getDeathCause());
if (!strand.isFiber())
currentActor.set(null);
JMXActorsMonitor.getInstance().actorTerminated(ref, strand);
}
}
Aggregations