All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JavaGroups.Channel

java.lang.Object
   |
   +----JavaGroups.Channel

public abstract class Channel
extends Object
implements Transportable
A channel represents one member of a specific group in a Java VM. Only a single object at a time is allowed to connect to a channel, but there can be more than one channel in an application (for different or the same groups). Using Group objects, multiple objects can connect to a channel.

Messages can be multicast to all objects connected to all channels with the same name using the Cast or Send methods and messages can be received using the Receive method.

Various degrees of sophistication in message exchange can be achieved using building blocks on top of channels, e.g. light-weight groups, synchronous message invocation, or remote method calls. Channels are on the same abstraction level as sockets, and should really be simple to use. Higher-level abstractions are all built on top of channels.


Constructor Index

 o Channel()

Method Index

 o Cast(byte[])
Send to all members
 o Connect(long)
Start receiving (and storing) msgs
 o Destroy()
Deletes the channel
 o Disconnect()
Stop receiving msgs
 o GetAddress()
 o GetMembers()
Get all members
 o GetName()
 o GetNumMembers()
Get number of members connected to channel including caller
 o Receive(long)
Receive a message (must be connected)
 o Send(Message)
Send a message
 o Send(Object, byte[])
Send to 1 member
 o Send(Vector, byte[])
Send to a subset of the members
 o SetMembershipListener(MembershipListener)

Constructors

 o Channel
 public Channel()

Methods

 o Connect
 public abstract void Connect(long timeout) throws Exception
Start receiving (and storing) msgs

Parameters:
timeout - Wait timeout milliseconds until other members are found (a new view is installed). 0 means don't wait. The call returns when some members are found or timeout ms have elasped, whichever comes first
Throws: Exception
When the connection cannot be established
 o Disconnect
 public abstract void Disconnect()
Stop receiving msgs

 o Destroy
 public abstract void Destroy()
Deletes the channel

 o Cast
 public abstract void Cast(byte msg[]) throws Exception
Send to all members

 o Send
 public abstract void Send(Object dest_addr,
                           byte msg[]) throws Exception
Send to 1 member

 o Send
 public abstract void Send(Vector dests,
                           byte msg[]) throws Exception
Send to a subset of the members

 o Send
 public abstract void Send(Message msg) throws Exception
Send a message

 o Receive
 public abstract Message Receive(long timeout) throws Exception
Receive a message (must be connected)

Parameters:
timeout - Value in milliseconds. Return value is null when timeout is reached. Value of 0 means wait forever
 o GetMembers
 public abstract Vector GetMembers()
Get all members

 o GetNumMembers
 public abstract int GetNumMembers()
Get number of members connected to channel including caller

 o SetMembershipListener
 public abstract void SetMembershipListener(MembershipListener listener)
 o GetAddress
 public abstract Object GetAddress()
 o GetName
 public abstract String GetName()

All Packages  Class Hierarchy  This Package  Previous  Next  Index