|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--JavaGroups.Channel
|
+--JavaGroups.EnsChannel
EnsChannel is an implementation of Channel based on Ensemble. It maps a process group to a channel. Requirements are the presence of an executable called outboard (which is Ensemble) and gossip running.
| Fields inherited from class JavaGroups.Channel |
BLOCK,
GET_STATE_EVENTS,
LOCAL,
SUSPECT,
VIEW |
| Constructor Summary | |
EnsChannel()
|
|
EnsChannel(java.lang.Object props)
Creates a new EnsChannel, which spawns an outboard process and connects to it. |
|
EnsChannel(java.lang.Object props,
java.lang.String transport_props,
int outboard_port)
Creates a new EnsChannel. |
|
| Method Summary | |
void |
AcceptedView(Hot_GroupContext gctx,
java.lang.Object env,
Hot_ViewState viewState)
Called to update you with the new view |
void |
Block(Hot_GroupContext gctx,
java.lang.Object env)
Called to let you know Ensemble is blocking |
void |
BlockOk()
Called to acknowledge a Block (callback in MembershipListener or
BlockEvent received from call to Receive). |
void |
Close()
Destroys the channel and its associated resources (e.g. |
void |
Connect(java.lang.Object address)
Connects the channel to a group. |
void |
Disconnect()
Disconnects the channel from the current group (if connected), leaving the group. |
void |
Exit(Hot_GroupContext gctx,
java.lang.Object env)
Called upon an Exit |
void |
finalize()
|
boolean |
GetAllStates(java.util.Vector targets,
long timeout)
Retrieve all states of the group members. |
java.lang.Object |
GetGroupAddress()
Returns the group address of the group of which the channel is a member. |
java.lang.Object |
GetLocalAddress()
Returns the channel's own address. |
java.lang.Object |
GetOpt(int option)
Gets an option. |
boolean |
GetState(java.lang.Object target,
long timeout)
Retrieve the state of the group. |
View |
GetView()
Gets the current view. |
void |
Heartbeat(Hot_GroupContext gctx,
java.lang.Object env,
int rate)
Called to issue you a heartbeat |
java.lang.Object |
Peek(long timeout)
Returns the next message, view, block, suspect or other event without removing it from the queue. |
java.lang.Object |
Receive(long timeout)
Receives a message, a view change or a block event. |
void |
ReceiveCast(Hot_GroupContext gctx,
java.lang.Object env,
Hot_Endpoint origin,
Hot_Message msg)
Called when Ensemble receives a Cast from your group |
void |
ReceiveSend(Hot_GroupContext gctx,
java.lang.Object env,
Hot_Endpoint origin,
Hot_Message msg)
Called when Ensemble receives a point-to-point message for you |
void |
ReturnState(java.lang.Object state)
Called by the application is response to receiving a GetState object when
calling Receive. |
void |
Send(Message msg)
Sends a message to a destination. |
void |
SetOpt(int option,
java.lang.Object value)
Sets an option. |
| Methods inherited from class JavaGroups.Channel |
Down,
SetChannelListener,
SetUpHandler |
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public EnsChannel()
throws ChannelException
public EnsChannel(java.lang.Object props)
throws ChannelException
name - Channel name. All channels with the same name form a group.properties - Ensemble properties (cf. Ensemble reference manual).
A value of null uses the default properties.
public EnsChannel(java.lang.Object props,
java.lang.String transport_props,
int outboard_port)
throws ChannelException
outboard_port.
This allows multiple EnsChannels to share a copy of outboard. If the port is 0, outboard
will be spawned. Parameter transport_props defines the type
of transport to be used (UDP, ATM, IP MCAST etc).properties - Ensemble properties (cf. Ensemble reference manual).
A value of null uses the default properties.transport_props - Transport parameters. Null means use default (UDP).
Example: "UDP:DEERING" uses IP multicast (gossip is not
needed in this case).outboard_port - Port on which the local outboard process is listening. The outboard
process has to be started before. Value of 0 means spawn outboard
nevertheless.| Method Detail |
public void Connect(java.lang.Object address)
throws ChannelClosed
All channels with the same group address form a group, that means all messages sent to the group will be received by all channels connected to the same group address.
The group address is opaque, and can only be interpreted by a channel implementation, i.e. the implementation decides what to do with the object.
Channel.Disconnectpublic void Disconnect()
Channel.Connectpublic void Close()
ChannelClosed exception
(or results in a null operation). It is a null operation if the channel is already closed.
If the channel is connected to a group, Disconnect will be called first.
public void finalize()
public void Send(Message msg)
throws ChannelNotConnected,
ChannelClosed
null address sends the message
to all group members.
oneway field which determines whether a response is
expected etc.
msg - The message to be sent. Destination and buffer should be set. A null destination
means to send to all group members.
public java.lang.Object Receive(long timeout)
throws ChannelNotConnected,
ChannelClosed,
Timeout
SetOpt, the
type of objects to be received can be determined (e.g. not views and blocks, just
messages).
The possible types returned can be:
Message. Normal message
Event. All other events (used by JChannel)
View. A view change.
BlockEvent. A block event indicating an impending view change.
SuspectEvent. A notification of a suspected member.
GetStateEvent. The current state of the application should be
returned using ReturnState.
SetStateEvent. The state of a single/all members as requested previously
by having called instanceof operator can be used to discriminate between different types
returned.timeout - Value in milliseconds. Value <= 0 means wait forever
public java.lang.Object Peek(long timeout)
throws ChannelNotConnected,
ChannelClosed,
Timeout
timeout - Value in milliseconds. Value <= 0 means wait foreverReceivepublic View GetView()
Receive to do so. The view may only be available after a successful
Connect. The result of calling this method on an unconnected channel
is implementation defined (may return null). Calling it on a channel that is not
enabled to receive view events (via SetOpt) returns
null. Calling this method on a closed channel returns a null view.public java.lang.Object GetLocalAddress()
Send operation.public java.lang.Object GetGroupAddress()
Connect. Calling this method on a closed
channel returns null.
public void SetOpt(int option,
java.lang.Object value)
BLOCK (0). Turn the reception of BLOCK events on/off (value is Boolean).
Default is off. If set to on, receiving VIEW events will be set to on, too.
VIEW (1). Turn the reception of VIEW events on/off (value is Boolean).
Default is on.
SUSPECT (2). Turn the reception of SUSPECT events on/off (value is Boolean).
Default is on.
LOCAL (3). Receive its own broadcast messages to the group
(value is Boolean). Default is on.
GET_STATE_EVENTS (4). Turn the reception of GetState events on/off
(value is Boolean). Default is off, which means that no other members can
ask this member for its state (null will be returned).
public java.lang.Object GetOpt(int option)
null.option - The option to be returned.public void BlockOk()
MembershipListener or
BlockEvent received from call to Receive).
After sending BlockOk, no messages should be sent until a new view has been received.
Calling this method on a closed channel has no effect.
public boolean GetState(java.lang.Object target,
long timeout)
SetStateEvent will have been
added to the channel's queue, causing Receive to return the state in one of
the next invocations. If false, no state will be retrieved by Receive.target - The address of the member from which the state is to be retrieved. If it is
null, the oldest member is contacted.timeout - Milliseconds to wait for the response (0 = wait indefinitely).
public boolean GetAllStates(java.util.Vector targets,
long timeout)
SetStateEvent will have been
added to the channel's queue, causing Receive to return the states in one of
the next invocations. If false, no states will be retrieved by Receive.targets - A list of members which are contacted for states. If the list is null,
all the current members of the group will be contacted.timeout - Milliseconds to wait for the response (0 = wait indefinitely).public void ReturnState(java.lang.Object state)
GetState object when
calling Receive.state - The state of the application as a Serializable or Externaizable
(to send over the network).
public void ReceiveCast(Hot_GroupContext gctx,
java.lang.Object env,
Hot_Endpoint origin,
Hot_Message msg)
public void ReceiveSend(Hot_GroupContext gctx,
java.lang.Object env,
Hot_Endpoint origin,
Hot_Message msg)
public void AcceptedView(Hot_GroupContext gctx,
java.lang.Object env,
Hot_ViewState viewState)
public void Heartbeat(Hot_GroupContext gctx,
java.lang.Object env,
int rate)
public void Block(Hot_GroupContext gctx,
java.lang.Object env)
public void Exit(Hot_GroupContext gctx,
java.lang.Object env)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||