jiface.otp.nodes

abstract-node-behaviour

AbstractNodeObject

protocol

). The location of a user’s home directory is determined using the system property user.home, which may not be automatically set on all platforms.

Instances of this class cannot be created directly, use one of the subclasses instead.

members

->str

(->str this)

Return a string representation of the node.

create-server-transport

(create-server-transport this port-num)

Create instance of OtpServerTransport.

create-transport

(create-transport this addr port-num)

Create instance of OtpTransport.

get-alivename

(get-alivename this)

Get the alivename part of the hostname.

get-hostname

(get-hostname this)

Get the hostname part of the nodename.

get-name

(get-name this)

Get the name of this node.

default-node

Get the default node.

The results of this function are memoized as the intent is to obtain a singleton instance of the default node. (The Erlang JInterface docs recommend that only one node be run per JVM instance.)

local-node-behaviour

LocalNodeObject

protocol

This class represents local node types. It is used to group the node types OtpNode and OtpSelf.

members

create-pid

(create-pid this)

Create an Erlang pid.

create-port

(create-port this)

Create an Erlang port.

create-ref

(create-ref this)

Create an Erlang ref.

get-port

(get-port this)

Get the port number used by this node.

node

(node node-name & args)

Constructor for OtpNode.

If one arg is passed, it must be of type String, representing the node name.

If two args are passed, the first must be of type String and the second must be either an OtpTransportFactory or a String representing the Erlang cookie.

If three args are passed, they must be:

  • node name (String)
  • Erlang cookie (String)
  • port number (Integer) or an OtpTransportFactory

If four args are passed, they must be:

  • node name (String)
  • Erlang cookie (String)
  • port number (Integer)
  • an OtpTransportFactory

node-behaviour

NodeObject

protocol

Represents a local OTP node. This class is used when you do not wish to manage connections yourself - outgoing connections are established as needed, and incoming connections accepted automatically. This class supports the use of a mailbox API for communication, while management of the underlying communication mechanism is automatic and hidden from the application programmer.

Once an instance of this class has been created, obtain one or more mailboxes in order to send or receive messages. The first message sent to a given node will cause a connection to be set up to that node. Any messages received will be delivered to the appropriate mailboxes.

To shut down the node, call (close). This will prevent the node from accepting additional connections and it will cause all existing connections to be closed. Any unread messages in existing mailboxes can still be read, however no new messages will be delivered to the mailboxes.

Note that the use of this class requires that EPMD (Erlang Port Mapper Daemon) is running on each cooperating host. This class does not start EPMD automatically as Erlang does, you must start it manually or through some other means. See the Erlang documentation for more information about this.

members

close

(close this)

Close the node.

close-mbox

(close-mbox this mbox)(close-mbox this mbox reason)

Close the specified mailbox. If not reason is provided, the default reason of ‘normal’ is used.

create-mbox

(create-mbox this)(create-mbox this name)

Create a mailbox that can be used to send and receive messages with other, similar mailboxes and with Erlang processes. If a name name is not provided, the Mbox is simply unnamed.

get-names

(get-names this)

Get a list of all known registered names on this node.

ping

(ping this node-name timeout)

Determine if another node is alive.

register-mbox

(register-mbox this mbox-name mbox)

Register or remove a name for the given mailbox.

register-status-handler

(register-status-handler this handler)

Register interest in certain system events.

set-flags

(set-flags this flags)

whereis

(whereis this mbox-name)

Determine the pid corresponding to a registered name on this node.

peer

(peer node-name & args)

Constructor for OtpPeer.

Represents a remote OTP node. It acts only as a container for the nodename and other node-specific information that is needed by the OtpConnection class.

If one arg is passed, it must be of type String, representing the node name.

If two args are passed, the first must be of type String and the second must be an OtpTransportFactory.

self

(self node-name & args)

Constructor for OtpSelf.

If one arg is passed, it must be of type String, representing the node name.

If two args are passed, the first must be of type String and the second must be either an OtpTransportFactory or a String representing the Erlang cookie.

If three args are passed, they must be:

  • node name (String)
  • Erlang cookie (String)
  • port number (Integer) or an OtpTransportFactory

If four args are passed, they must be:

  • node name (String)
  • Erlang cookie (String)
  • port number (Integer)
  • an OtpTransportFactory

self-behaviour

SelfObject

protocol

Represents an OTP node. It is used to connect to remote nodes or accept incoming connections from remote nodes.

When the Java node will be connecting to a remote Erlang, Java or C node, it must first identify itself as a node by creating an instance of this class, after which it may connect to the remote node.

When you create an instance of this class, it will bind a socket to a port so that incoming connections can be accepted. However the port number will not be made available to other nodes wishing to connect until you explicitely register with the port mapper daemon by calling publishPort().

members

accept

(accept this)

Accept an incoming connection from a remote node.

connect

(connect this peer)

Open a connection to a remote node.

get-pid

(get-pid this)

Get the Erlang PID that will be used as the sender id in all “anonymous” messages sent by this node.

publish-port

(publish-port this)

Make public the information needed by remote nodes that may wish to connect to this one.

unpublish-port

(unpublish-port this)

Unregister the server node’s name and port number from the Erlang port mapper, thus preventing any new connections from remote nodes.