use of org.nustaq.kontraktor.IPromise in project kontraktor by RuedigerMoeller.
the class JNPM method getDistributions.
// map of tag => version
protected IPromise<JsonObject> getDistributions(String module) {
Promise res = new Promise();
// http://registry.npmjs.org/-/package/react/dist-tags
http.getContent(config.getRepo() + "/-/package/" + module + "/dist-tags").then((cont, err) -> {
if (cont != null) {
JsonObject parse = Json.parse(cont).asObject();
res.resolve(parse);
} else {
res.reject(err);
}
});
return res;
}
use of org.nustaq.kontraktor.IPromise 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.IPromise 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