All Packages Class Hierarchy This Package Previous Next Index
Class jive.erlang.EReceiver
java.lang.Object
|
+----jive.erlang.EReceiver
- public class EReceiver
- extends Object
- implements Runnable
EReceiver is a class that reads messages sent from the server to the client.
The class will read each message, find out who should receive the message
and then deliver the message to the recipient.
Each class that wants to receive messages from the Erlang server should
implement the EReceive interface and then register itself to the EReceiver
object.
- Author:
- Kaj Nygren (kaj@medialab.ericsson.se), Joakim Grebenö (jocke@erix.ericsson.se)
-
connect()
-
Connects the client to the server.
-
connected()
-
Returns whether or not the client is connected to the server.
-
disconnect()
-
Disconnects the client from the server.
-
init(Socket, Unpacker, EProcess)
- Called from the ESock object when the socket connection has been opened.
-
register(EReceive)
- Registers an EReceive object.
-
remove(EInteger)
- Unregisters an EReceive object given the corresponding EInteger targetID.
-
remove(EReceive)
- Unregisters an EReceive object.
-
run()
- The main loop of this thread.
-
self()
- Returns the EProcess that represents the Erlang process that sends
messages to this client.
-
toID(EReceive)
- Converts an EReceive target to the corresponding targetID.
-
toTarget(EInteger)
- Converts an EInteger targetID to the corresponding EReceive target.
connect
public void connect() throws JiveIOException
- Connects the client to the server.
- Throws: JiveIOException
- If a connection error occurred.
disconnect
public void disconnect()
- Disconnects the client from the server.
connected
public boolean connected()
- Returns whether or not the client is connected to the server.
init
protected void init(Socket s,
Unpacker unpacker,
EProcess self)
- Called from the ESock object when the socket connection has been opened.
The method is inherently synchronized since it's called from
ESock.initReceiver which is synchronized.
run
public void run()
- The main loop of this thread.
It waits until a message has been delivered. Then it will parse the
message and deliver it to the recipient.
self
protected EProcess self() throws JiveIOException
- Returns the EProcess that represents the Erlang process that sends
messages to this client.
The self process should be supplied to all Erlang processes that should
be able to communicate with an EReceive object on the client.
- Throws: JiveIOException
- If the client isn't connected.
register
public EInteger register(EReceive target)
- Registers an EReceive object. The EReceive object can then receive
messages that are sent from an Erlang process.
The method returns an EInteger which should be sent to the Erlang
process wanting to communicate with the EReceive object.
remove
public void remove(EReceive target)
- Unregisters an EReceive object.
remove
public void remove(EInteger targetID)
- Unregisters an EReceive object given the corresponding EInteger targetID.
toID
public EInteger toID(EReceive target)
- Converts an EReceive target to the corresponding targetID. This
method assumes that the EReceive target is registered.
toTarget
public EReceive toTarget(EInteger targetID)
- Converts an EInteger targetID to the corresponding EReceive target. This
method assumes that the EReceive target is registered.
All Packages Class Hierarchy This Package Previous Next Index