|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjbora.JBora
The main class. A JBora object can be used for interacting with a group.
First you join the group. Then you can receive events and multicast messages. Finally you leave the group. Once you have left the group, you cannot reuse the object.
Implementation notes: A JBora object is shared amongst all application
threads within the same process, but you may have multiple JBora
processes withing the same VM, as long as you assign them different
group member names. Each process within the group will be identified
by JBora as: name@host_name.
JBora object delegates access to the underlying group
communication system to a private SpreadJBora object.
The SpreadJBora object will create one SpreadListener thread, that is the
only thread that actually receives view changes and multicasts from the
underlying group communication system.
The JBora.receive() operation extracts (FIFO) one event at the time from the system end returns it to the user.
This product uses software developed by Spread Concepts LLC
for use in the Spread toolkit.
For more information about
Spread, see www.spread.org.
| Constructor Summary | |
JBora(int w,
int num,
String myName,
String groupName)
|
|
| Method Summary | |
void |
close()
Close the connection to Spread. |
View |
getCurrentView()
Returns the current view of the group. |
ProcessID |
getMySelf()
Returns the ID of the executing process |
void |
join()
Join the group (name of the group is specified in the JBora constructor). |
void |
leave()
Leave the group. |
Message |
localCall(Message req)
Primitive for intra-process communication. |
void |
localRespond(Message req,
Message resp)
Responds to a localCall. |
void |
multiCast(Message msg)
Sends a message (multicasts) to all members of the current View. |
PropagateEvent |
propagate(Message msg)
Multicasts a message to all current view members and returns a PropagateEvent containing:
A list of members that replied:
ProcessID[];
Reply message from each member that replied:
Vector;
Other events received during propagation:
Event[]. |
Event |
receive()
Receives an Event from JBora. |
int |
whiteBoardRead(ProcessID proc)
Reads the whiteboard value associated with the specified view member. |
void |
whiteBoardUpdate(int val)
Updates the whiteboard value associated with the invoking process |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public JBora(int w,
int num,
String myName,
String groupName)
throws JBoraException
w - Maximum waiting time (in msec) before sending white board informationnum - Maximum number of group members
(necessary for determining primariness)myName - Name of the invoking group membergroupName - Name of the group that will be joined
PanicException - Error while connecting to the Spread
daemon
JBoraException| Method Detail |
public void join()
throws AlreadyJoinedException,
NotJoinedException,
PanicException
constructor).
It returns immediately.
AlreadyJoinedException - Process already joined
PanicException - Unrecoverable error
NotJoinedException
public void leave()
throws PanicException,
NotJoinedException
NotJoinedException - Process not joined
PanicException - Unrecoverable error
public void close()
throws PanicException,
NotJoinedException
PanicException
NotJoinedException
public void multiCast(Message msg)
throws PanicException,
NotJoinedException,
MessageTooBigException
View.
msg - Message
NotJoinedException - Process not joined
MessageTooBigException - Message too big
PanicException - Unrecoverable error
public Event receive()
throws PanicException,
NotJoinedException
Event from JBora.
This method is NOT "Thread safe" (meaning only one thread per
process should call receive() method).
NotJoinedException - Process not joined
PanicException - Unrecoverable error
public PropagateEvent propagate(Message msg)
throws PanicException,
NotJoinedException,
MessageTooBigException
PropagateEvent containing:
ProcessID[];
Vector;
Event[].
If a view change occurs during the propagation, the whole process of propagation restarts.
This method is NOT a "Thread safe" method. (Should be invoked by only one thread per process.)
propagate(msg) operation was designed to simplify the exchange of application-defined information upon a view expansion (a view change installing a view with a process that was not a member of the previous view). It is a blocking operation that multicasts msg and terminates upon receiving a message sent through grp.propagate() from each member of the (new) view.
If any view member chooses to call propagate(), then every group member must do so after a trigger event (normally a view expansion) -- otherwise the propagate() call will not complete.
JBora.propagate(msg) is similar to a loop that executes
JBora.receive() and terminates upon
receiving a message from each view member. This operation
encapsulates many low-level details that otherwise would have
to be programmed explicitly, in particular, the handling of
messages and view changes delivered while exchanging
application-defined information upon a view expansion.
msg - Message to propagate
PanicException - Error while communicating to the group
NotJoinedException - The server has not joined the group
MessageTooBigException - The message is too big
public int whiteBoardRead(ProcessID proc)
throws JBoraException,
NotJoinedException
proc - Process ID
WhiteboardException
JBoraException
NotJoinedException
public void whiteBoardUpdate(int val)
throws JBoraException,
NotJoinedException
val - Value
WhiteboardException
JBoraException
NotJoinedException
public Message localCall(Message req)
throws PanicException
receive and the response
will be sent by that thread by invoking
localRespond.
req - Request message
PanicException - Unrecoverable error
public void localRespond(Message req,
Message resp)
throws PanicException
localCall.
req - Request messageresp - Response message
PanicException - Unrecoverable error (attempt to write into a
ResponseContainer where something has already been written,
The request was not obtained via receive(),
or that request was already answered.).public View getCurrentView()
public ProcessID getMySelf()
NotJoinedException - The owner is null (not joined)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||