Exemple #1
0
 /**
  * Send a message to a named mailbox created from another node.
  *
  * @param name
  *                the registered name of recipient mailbox.
  *
  * @param node
  *                the name of the remote node where the recipient mailbox is
  *                registered.
  *
  * @param msg
  *                the body of the message to send.
  *
  */
 public void send(String name, String node, OtpErlangObject msg)
 {
     try
     {
         String currentNode = home.Node;
         if (node.Equals(currentNode))
         {
             send(name, msg);
         }
         else if (node.IndexOf('@', 0) < 0 && node.Equals(currentNode.Substring(0, currentNode.IndexOf('@', 0))))
         {
             send(name, msg);
         }
         else
         {
             // other node
             OtpCookedConnection conn = home.getConnection(node);
             if (conn == null)
             {
                 return;
             }
             conn.send(self, name, msg);
         }
     }
     catch (Exception)
     {
     }
 }
Exemple #2
0
 /**
  * Send a message to a remote {@link OtpErlangPid pid}, representing either
  * another {@link OtpMbox mailbox} or an Erlang process.
  *
  * @param to
  *                the {@link OtpErlangPid pid} identifying the intended
  *                recipient of the message.
  *
  * @param msg
  *                the body of the message to send.
  *
  */
 public void send(OtpErlangPid to, OtpErlangObject msg)
 {
     try
     {
         String node = to.Node;
         if (node.Equals(home.Node))
         {
             home.deliver(new OtpMsg(to, (OtpErlangObject)msg.Clone()));
         }
         else
         {
             OtpCookedConnection conn = home.getConnection(node);
             if (conn == null)
             {
                 return;
             }
             conn.send(self, to, msg);
         }
     }
     catch (Exception)
     {
     }
 }