}
break;
case testGenEvent:
if (i == 1) {
final DelayedVal<String> dv = new DelayedVal<>();
spawnGenEvent(new Initializer() {
@Override
public void init() throws SuspendExecution {
LocalGenEvent.currentGenEvent().register("myEventServer");
try {
LocalGenEvent<String> ge = LocalGenEvent.currentGenEvent();
ge.addHandler(new EventHandler<String>() {
@Override
public void handleEvent(String event) {
dv.set(event);
System.out.println("sout " + event);
LocalGenEvent.currentGenEvent().shutdown();
}
});
} catch (InterruptedException ex) {
System.out.println(ex);
}
}
@Override
public void terminate(Throwable cause) throws SuspendExecution {
System.out.println("terminated");
}
});
try {
String get = dv.get();
System.out.println("got msg " + get);
assert get.equals("hello world");
} catch (SuspendExecution ex) {
}
} else {
spawnActor(new BasicActor<Message, Void>() {
protected Void doRun() throws SuspendExecution, InterruptedException {
final GenEvent<String> ge = (GenEvent) getActor("myEventServer");
ge.notify("hello world");
return null;
}
}).join();
}
break;
case testMultiGetActor:
if (i == 1) {
spawnGenEvent(new Initializer() {
AtomicInteger ai = new AtomicInteger();
@Override
public void init() throws SuspendExecution {
LocalGenEvent.currentGenEvent().register("myEventServer");
System.out.println("kkkvb " + LocalGenEvent.getActor("myEventServer"));
try {
LocalGenEvent<String> ge = LocalGenEvent.currentGenEvent();
ge.addHandler(new EventHandler<String>() {
@Override
public void handleEvent(String event) {
System.out.println("msg no " + ai.incrementAndGet() + ": " + event);
}
});
} catch (InterruptedException ex) {
System.out.println(ex);
}
}
@Override
public void terminate(Throwable cause) throws SuspendExecution {
System.out.println("terminated");
}
}).join();
} else {
Queue<LocalActor> queue = new LinkedList<>();
for (int j = 0; j < 1000; j++) {
final BasicActor<Message, Void> actor = spawnActor(new BasicActor<Message, Void>("actor-" + j) {
protected Void doRun() throws SuspendExecution, InterruptedException {
try {
final GenEvent<String> ge = (GenEvent) getActor("myEventServer");
ge.notify("hwf " + getName());
} catch (Exception e) {
System.out.println("error in " + getName());
throw e;
}
return null;
}
});
queue.add(actor);
// actor.join();
}
for (LocalActor localActor : queue)
localActor.join();
Thread.sleep(500);
}
break;
case testOrdering:
if (i == 1) {
spawnGenEvent(new Initializer() {
AtomicInteger ai = new AtomicInteger();
@Override
public void init() throws SuspendExecution {
LocalGenEvent.currentGenEvent().register("myEventServer");