use of com.ericsson.otp.erlang.OtpMbox in project erlide_eclipse by erlang.
the class OtpRpc method async_call_result.
@Override
public void async_call_result(final IRpcResultCallback cb, final String m, final String f, final String signature, final Object... args) throws RpcException {
final OtpErlangAtom gleader = OtpRpc.USER_ATOM;
try {
final Object[] args1 = new Object[args.length + 1];
System.arraycopy(args, 0, args1, 1, args.length);
final OtpMbox mbox = localNode.createMbox();
args1[0] = mbox.self();
new RpcResultReceiver(mbox, cb);
rpcCast(localNode, nodeName, false, gleader, m, f, signature, args1);
} catch (final SignatureException e) {
throw new RpcException(e);
}
}
use of com.ericsson.otp.erlang.OtpMbox in project erlide_eclipse by erlang.
the class OtpRpc method send.
@Override
public void send(final OtpErlangPid pid, final Object msg) {
try {
checkConnected();
final OtpMbox mbox = localNode.createMbox();
try {
if (mbox != null) {
if (OtpRpc.CHECK_RPC) {
ErlLogger.debug("SEND " + pid + "-> " + msg);
}
mbox.send(pid, TypeConverter.java2erlang(msg, "x"));
}
} finally {
localNode.closeMbox(mbox);
}
} catch (final Exception e) {
}
}
use of com.ericsson.otp.erlang.OtpMbox in project erlide_eclipse by erlang.
the class OtpRpc method sendRpcCall.
private synchronized RpcFuture sendRpcCall(final OtpNode node, final String peer, final boolean logCalls, final OtpErlangObject gleader, final String module, final String fun, final String signature, final Object... args0) throws SignatureException {
final OtpErlangObject[] args = convertArgs(signature, args0);
OtpErlangObject res = null;
final OtpMbox mbox = node.createMbox();
res = buildRpcCall(mbox.self(), gleader, module, fun, args);
if (logCalls) {
final Object[] args01 = { module, fun, argString(args) };
ErlLogger.debug("call -> %s:%s(%s)", args01);
}
//
final OtpErlangRef ref = RpcMonitor.recordRequest(node, peer, module, fun, args, OtpErlang.sizeOf(res));
//
mbox.send("rex", peer, res);
if (OtpRpc.CHECK_RPC) {
ErlLogger.debug("RPC " + mbox.hashCode() + "=> " + res);
}
return new RpcFuture(ref, mbox, module + ":" + fun + "/" + args0.length, logCalls, this);
}
Aggregations