use of org.nustaq.kontraktor.util.Pair in project kontraktor by RuedigerMoeller.
the class ServiceRegistry method serviceDumper.
public void serviceDumper() {
if (!isStopped()) {
try {
Log.Info(this, "------");
services.forEach((k, sd) -> Log.Info(this, "" + sd));
Log.Info(this, "------");
listeners.forEach(cb -> {
cb.pipe(new Pair(SERVICEDUMP, services));
});
if (ClusterCfg.isDirty()) {
config = ClusterCfg.read();
listeners.forEach(cb -> cb.pipe(new Pair(CONFIGUPDATE, config)));
}
} catch (Exception e) {
Log.Error(this, e);
}
delayed(10000, () -> serviceDumper());
}
}
use of org.nustaq.kontraktor.util.Pair in project kontraktor by RuedigerMoeller.
the class KxStreamServer method init.
public void init() {
streams = new HashMap<>();
timeSink = new EventSink<Long>();
// EventSink is *not* remoteable,
// need to create an remoteable async publisher (is actor, so remoteable)
streams.put("TIME", new Pair(timeSink.map(l -> l), true));
tick();
}
use of org.nustaq.kontraktor.util.Pair in project kontraktor by RuedigerMoeller.
the class RESTActor method postStuff1.
// curl -i -X POST --data "{ \"key\": \"value\", \"nkey\": 13 }" http://localhost:8080/api/stuff1
public IPromise postStuff1(JsonObject body, HeaderMap headerValues) {
headerValues.forEach(hv -> {
Log.Info(this, "" + hv.getHeaderName());
hv.forEach(s -> {
Log.Info(this, " " + s);
});
});
Log.Info(this, "" + body);
return resolve(new Pair(202, body.toString()));
}
use of org.nustaq.kontraktor.util.Pair in project kontraktor by RuedigerMoeller.
the class HttpObjectSocket method getNextQueuedMessage.
public Pair<byte[], Integer> getNextQueuedMessage() {
synchronized (this) {
// if ( queue.available() < 8 )
{
try {
flush();
} catch (Exception e) {
FSTUtil.rethrow(e);
}
}
if (queue.available() > 8) {
int seq = queue.readInt();
int len = queue.readInt();
if (len > 0 && queue.available() >= len)
return new Pair(queue.readByteArray(len), seq);
else
return new Pair(new byte[0], 0);
} else {
return new Pair(new byte[0], 0);
}
}
}
Aggregations