org.objectweb.tribe.channel
Class ReliableGroupChannel

java.lang.Object
  extended byorg.objectweb.tribe.channel.ReliableGroupChannel
Direct Known Subclasses:
JGroupsReliableChannel, ReliableGroupChannelWithGms

public class ReliableGroupChannel
extends java.lang.Object

This class defines a ReliableGroupChannel

Version:
1.0
Author:
Emmanuel Cecchet

Field Summary
protected  AbstractChannelPool channelPool
           
protected  Group currentGroup
           
protected  ReceiveBuffer incomingBuffer
           
protected  Member me
           
 
Constructor Summary
ReliableGroupChannel()
          Creates a new ReliableGroupChannel object without group membership service.
 
Method Summary
 void close()
          Closes the channel (also quits the current group if any).
 Group getCurrentGroup()
          Returns the current group we are connected to or null if we are not connected to any group.
 Member getLocalMembership()
          Returns the local membership value (Member object representing this channel in the group).
 void join(Group g)
          Join the group that has the given group identifier.
 void quit()
          Quit the current group without closing the channel.
 java.io.Serializable receive()
          Receives a new message from the channel.
 java.util.ArrayList send(java.io.Serializable msg)
          Sends the given message to all members of the group.
 java.util.ArrayList send(java.io.Serializable msg, java.util.ArrayList members)
          Sends a message to a subset of group members.
 java.util.ArrayList send(java.io.Serializable msg, GroupIdentifier gid, java.util.ArrayList members)
          Sends a message to members of group gid without being necessary member of the group.
protected  void setMembership(Member membership)
          Sets the membership value (me as a Member of the group).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

channelPool

protected AbstractChannelPool channelPool

incomingBuffer

protected ReceiveBuffer incomingBuffer

currentGroup

protected Group currentGroup

me

protected Member me
Constructor Detail

ReliableGroupChannel

public ReliableGroupChannel()
Creates a new ReliableGroupChannel object without group membership service.

Method Detail

join

public void join(Group g)
          throws AlreadyMemberException,
                 ChannelException,
                 NotConnectedException
Join the group that has the given group identifier.

Throws:
AlreadyMemberException - if we are already member of the group
NotConnectedException - if the channel is not connected
ChannelException - if an error is reported by the channel

quit

public void quit()
          throws ChannelException,
                 NotConnectedException
Quit the current group without closing the channel.

Throws:
ChannelException - if a communication error occurs
NotConnectedException - if the channel is not connected to any group

getCurrentGroup

public Group getCurrentGroup()
Returns the current group we are connected to or null if we are not connected to any group.

Returns:
Returns the current group or null.

send

public java.util.ArrayList send(java.io.Serializable msg)
                         throws ChannelException,
                                NotConnectedException
Sends the given message to all members of the group.

Parameters:
msg - message to send
Returns:
an ArrayList of Members who failed, or null if all members received successfully the message.
Throws:
ChannelException - if an error occurs
NotConnectedException - if the channel is not connected to any group

send

public java.util.ArrayList send(java.io.Serializable msg,
                                java.util.ArrayList members)
                         throws ChannelException,
                                NotConnectedException
Sends a message to a subset of group members.

Parameters:
msg - message to send
members - ArrayList of Member that are all part of the group
Returns:
an ArrayList of Members who failed, or null if all members received successfully the message.
Throws:
ChannelException - if an error occurs
NotConnectedException - if the channel is not connected to any group

send

public java.util.ArrayList send(java.io.Serializable msg,
                                GroupIdentifier gid,
                                java.util.ArrayList members)
                         throws ChannelException,
                                NotConnectedException
Sends a message to members of group gid without being necessary member of the group.

Parameters:
msg - message to send
members - ArrayList of Member that are all part of the group
Returns:
an ArrayList of Members who failed, or null if all members received successfully the message.
Throws:
ChannelException - if an error occurs
NotConnectedException - if the channel is not connected to any group

receive

public java.io.Serializable receive()
                             throws ChannelException,
                                    NotConnectedException
Receives a new message from the channel.

Returns:
the new message
Throws:
ChannelException - if an error occurs
NotConnectedException - if the channel is not connected to any group

close

public void close()
           throws ChannelException,
                  NotConnectedException
Closes the channel (also quits the current group if any).

Throws:
ChannelException - if a network error occurs
NotConnectedException - if the channel is not connected

getLocalMembership

public Member getLocalMembership()
Returns the local membership value (Member object representing this channel in the group).

Returns:
Returns the local membership (me).

setMembership

protected void setMembership(Member membership)
                      throws NotConnectedException
Sets the membership value (me as a Member of the group).

Parameters:
membership - The me to set.
Throws:
NotConnectedException - if the channel is not currently connected to any group


Copyright © 2004 - ObjectWeb Consortium - All Rights Reserved.