/** * Close the given Connection. * @param con the Connection to close if necessary * (if this is <code>null</code>, the call will be ignored) */ public static void releaseConnection(OtpConnection con) { if (con == null) { return; } con.close(); }
public void sendRPC(String mod, String fun, OtpErlangList args) throws IOException { otpConnection.sendRPC(mod, fun, args); }
/** * Open a connection to a remote node. * * @param other * the remote node to which you wish to connect. * * @return a connection to the remote node. * * @exception java.net.UnknownHostException * if the remote host could not be found. * * @exception java.io.IOException * if it was not possible to connect to the remote node. * * @exception OtpAuthException * if the connection was refused by the remote node. */ public OtpConnection connect(final OtpPeer other) throws IOException, UnknownHostException, OtpAuthException { return new OtpConnection(this, other); } }
OtpAuthException { try { return receiveMsg().getMsg(); } catch (final OtpErlangDecodeException e) { close(); throw new IOException(e.getMessage());
OtpConnection(final OtpSelf self, final OtpTransport s) throws IOException, OtpAuthException { super(self, s); this.self = self; queue = new GenericQueue(); start(); }
/** * Receive a raw (still encoded) message from a remote process. This message * blocks until a valid message is received or an exception is raised. * * <p> * If the remote node sends a message that cannot be decoded properly, the * connection is closed and the method throws an exception. * * @return an object containing a raw (still encoded) Erlang term. * * @exception java.io.IOException * if the connection is not active or a communication error * occurs. * * @exception OtpErlangExit * if an exit signal is received from a process on the peer * node, or if the connection is lost for any reason. * * @exception OtpAuthException * if the remote node sends a message containing an invalid * cookie. */ public OtpInputStream receiveBuf() throws IOException, OtpErlangExit, OtpAuthException { return receiveMsg().getMsgBuf(); }
public OtpErlangObject receiveRPC() throws IOException, OtpErlangExit, OtpAuthException { return otpConnection.receiveRPC(); }
OtpAuthException { final OtpErlangObject msg = receive();
rpc[1] = new OtpErlangTuple(call); send("rex", new OtpErlangTuple(rpc));
OtpAuthException { try { return receiveMsg(timeout).getMsg(); } catch (final OtpErlangDecodeException e) { close(); throw new IOException(e.getMessage());
OtpConnection(final OtpSelf self, final OtpPeer other) throws IOException, OtpAuthException { super(self, other); this.self = self; queue = new GenericQueue(); start(); }
throws InterruptedException, IOException, OtpErlangExit, OtpAuthException { return receiveMsg(timeout).getMsgBuf();
public void close() { otpConnection.close(); }
/** * Send an RPC request to the remote Erlang node. This convenience function * creates the following message and sends it to 'rex' on the remote node: * * <pre> * { self, { call, Mod, Fun, Args, user } } * </pre> * * <p> * Note that this method has unpredicatble results if the remote node is not * an Erlang node. * </p> * * @param mod * the name of the Erlang module containing the function to be * called. * @param fun * the name of the function to call. * @param args * an array of Erlang terms, to be used as arguments to the * function. * * @exception java.io.IOException * if the connection is not active or a communication error * occurs. */ public void sendRPC(final String mod, final String fun, final OtpErlangObject[] args) throws IOException { sendRPC(mod, fun, new OtpErlangList(args)); }
/** * Create a connection to a remote node. * * @param self * the local node from which you wish to connect. * * @return a connection to the remote node. * * @exception java.net.UnknownHostException * if the remote host could not be found. * * @exception java.io.IOException * if it was not possible to connect to the remote node. * * @exception OtpAuthException * if the connection was refused by the remote node. * * @deprecated Use the corresponding method in {@link OtpSelf} instead. */ @Deprecated public OtpConnection connect(final OtpSelf self) throws IOException, UnknownHostException, OtpAuthException { return new OtpConnection(self, this); }
try { newsock = sock.accept(); return new OtpConnection(this, newsock); } catch (final IOException e) { try {