use of com.twosigma.beakerx.kernel.comm.Comm in project beakerx by twosigma.
the class CommOpenHandler method handleMsg.
private void handleMsg(Message message) {
logger.debug("Processing CommOpenHandler");
Message reply = new Message();
HashMap<String, Serializable> map = new HashMap<>(6);
Map<String, Serializable> commMap = message.getContent();
Comm newComm = null;
if (isValidMessage(commMap)) {
newComm = readComm(commMap);
reply.setHeader(new Header(COMM_OPEN, message.getHeader().getSession()));
map.put(COMM_ID, newComm.getCommId());
map.put(TARGET_NAME, newComm.getTargetName());
map.put(DATA, new HashMap<>());
map.put(TARGET_MODULE, newComm.getTargetModule());
} else {
reply.setHeader(new Header(COMM_CLOSE, message.getHeader().getSession()));
map.put(DATA, new HashMap<>());
}
if (newComm != null) {
logger.debug("Comm opened, target name = " + newComm.getTargetName());
for (Handler<Message> handler : getKernelControlChanelHandlers(newComm.getTargetName())) {
newComm.addMsgCallbackList(handler);
}
kernel.addComm(newComm.getCommId(), newComm);
}
reply.setContent(map);
reply.setParentHeader(message.getHeader());
reply.setIdentities(message.getIdentities());
send(reply);
}
use of com.twosigma.beakerx.kernel.comm.Comm in project beakerx by twosigma.
the class NamespaceClient method set.
public synchronized Object set(String name, Object value) throws IOException {
Comm c = getAutotranslationComm();
HashMap<String, Serializable> data = new HashMap<>();
HashMap<String, Serializable> state = new HashMap<>();
state.put("name", name);
state.put("value", getJson(value));
state.put("sync", true);
data.put("state", state);
data.put("buffer_paths", new HashMap<>());
c.send(COMM_MSG, Comm.Buffer.EMPTY, new Comm.Data(data));
return value;
}
use of com.twosigma.beakerx.kernel.comm.Comm in project beakerx by twosigma.
the class NamespaceClient method runByTag.
public synchronized void runByTag(String tag) {
Comm c = getTagRunComm();
HashMap<String, Serializable> data = new HashMap<>();
HashMap<String, Serializable> state = new HashMap<>();
state.put("runByTag", tag);
data.put("state", state);
data.put("buffer_paths", new HashMap<>());
c.send(COMM_MSG, Comm.Buffer.EMPTY, new Comm.Data(data));
}
use of com.twosigma.beakerx.kernel.comm.Comm in project beakerx by twosigma.
the class NamespaceClient method getCodeCellsComm.
protected Comm getCodeCellsComm() {
if (codeCellsComm == null) {
codeCellsComm = new Comm(TargetNamesEnum.BEAKER_GETCODECELLS);
codeCellsComm.open();
}
return codeCellsComm;
}
use of com.twosigma.beakerx.kernel.comm.Comm in project beakerx by twosigma.
the class NamespaceClient method getTagRunComm.
protected Comm getTagRunComm() {
if (tagRunComm == null) {
tagRunComm = new Comm(TargetNamesEnum.BEAKER_TAG_RUN);
tagRunComm.open();
}
return tagRunComm;
}
Aggregations