use of org.nustaq.kontraktor.Promise in project kontraktor by RuedigerMoeller.
the class RemotingTest method fromRemote.
private void fromRemote(ConnectableActor con) {
RemotingTA remote = (RemotingTA) con.connect().await();
IPromise fin = new Promise();
AtomicInteger count = new AtomicInteger();
Integer expect = remote.sayHello(10, (str, err) -> {
if (Actors.isCont(err)) {
System.out.println("received:" + str);
count.incrementAndGet();
} else {
fin.complete();
}
}).await();
fin.await();
Assert.assertTrue(expect.intValue() == count.intValue());
}
use of org.nustaq.kontraktor.Promise in project kontraktor by RuedigerMoeller.
the class _JSR356ServerConnector method Publish.
public static IPromise<ActorServer> Publish(Actor facade, String path, Coding coding) {
_JSR356ServerConnector connector = new _JSR356ServerConnector();
try {
ActorServer actorServer = new ActorServer(connector, facade, coding);
actorServer.start();
ContainerProvider.getWebSocketContainer().connectToServer(connector, /*new DefaultClientEndpointConfig(),*/
new URI(path));
return new Promise<>(actorServer);
} catch (Exception e) {
e.printStackTrace();
return new Promise<>(null, e);
}
}
Aggregations