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

public get ( ) : Object
Результат Object
Пример #1
0
        /**
         * Block until a message arrives for this mailbox.
         *
         * @return an {@link OtpMsg OtpMsg} containing the header information as
         *         well as the body of the next message waiting in this mailbox.
         *
         * @exception OtpErlangExit
         *                    if a linked {@link OtpErlangPid pid} has exited or has
         *                    sent an exit signal to this mailbox.
         *
         */
        public virtual OtpMsg receiveMsg()
        {
            OtpMsg m = (OtpMsg)queue.get();

            switch (m.type())
            {
            case OtpMsg.exitTag:
            case OtpMsg.exit2Tag:
                try
                {
                    OtpErlangObject o = m.getMsg();
                    throw new OtpErlangExit(o, m.getSenderPid());
                }
                catch (OtpErlangDecodeException)
                {
                    throw new OtpErlangExit("unknown", m.getSenderPid());
                }

            default:
                return(m);
            }
        }
Пример #2
0
        /**
         * Receive a messge complete with sender and recipient information.
         *
         * @return an {@link OtpMsg OtpMsg} containing the header information about
         *         the sender and recipient, as well as the actual message contents.
         *
         * @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 OtpMsg receiveMsg()
        {
            Object o = queue.get();

            if (o is OtpMsg)
            {
                return((OtpMsg)o);
            }
            else if (o is IOException)
            {
                throw (IOException)o;
            }
            else if (o is OtpErlangExit)
            {
                throw (OtpErlangExit)o;
            }
            else if (o is OtpAuthException)
            {
                throw (OtpAuthException)o;
            }

            return(null);
        }