removeLink() публичный Метод

public removeLink ( OtpErlangPid local, OtpErlangPid remote ) : void
local OtpErlangPid
remote OtpErlangPid
Результат void
Пример #1
0
        /*
         * pass the message to the node for final delivery. Note that the connection
         * itself needs to know about links (in case of connection failure), so we
         * snoop for link/unlink too here.
         */
        public override void deliver(OtpMsg msg)
        {
            bool delivered = self.deliver(msg);

            switch (msg.type())
            {
            case OtpMsg.linkTag:
                if (delivered)
                {
                    links.addLink(msg.getRecipientPid(), msg.getSenderPid());
                }
                else
                {
                    try
                    {
                        // no such pid - send exit to sender
                        base.sendExit(msg.getRecipientPid(), msg.getSenderPid(), new OtpErlangAtom("noproc"));
                    }
                    catch (IOException)
                    {
                    }
                }
                break;

            case OtpMsg.unlinkTag:
            case OtpMsg.exitTag:
                links.removeLink(msg.getRecipientPid(), msg.getSenderPid());
                break;

            case OtpMsg.exit2Tag:
                break;
            }

            return;
        }
Пример #2
0
        /**
         * <p>
         * Remove a link to a remote mailbox or Erlang process. This method removes
         * a link created with {@link #link link()}. Links are idempotent; calling
         * this method once will remove all links between this mailbox and the
         * remote {@link OtpErlangPid pid}.
         * </p>
         *
         * @param to
         *                the {@link OtpErlangPid pid} representing the object to
         *                unlink from.
         *
         */
        public void unlink(OtpErlangPid to)
        {
            links.removeLink(self, to);

            try
            {
                String node = to.Node;
                if (node.Equals(home.Node))
                {
                    home.deliver(new OtpMsg(OtpMsg.unlinkTag, self, to));
                }
                else
                {
                    OtpCookedConnection conn = home.getConnection(node);
                    if (conn != null)
                    {
                        conn.unlink(self, to);
                    }
                }
            }
            catch (Exception)
            {
            }
        }