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.
-
Channel()
-
-
Cast(byte[])
- Send to all members
-
Connect(long)
- Start receiving (and storing) msgs
-
Destroy()
- Deletes the channel
-
Disconnect()
- Stop receiving msgs
-
GetAddress()
-
-
GetMembers()
- Get all members
-
GetName()
-
-
GetNumMembers()
- Get number of members connected to channel including caller
-
Receive(long)
- Receive a message (must be connected)
-
Send(Message)
- Send a message
-
Send(Object, byte[])
- Send to 1 member
-
Send(Vector, byte[])
- Send to a subset of the members
-
SetMembershipListener(MembershipListener)
-
Channel
public Channel()
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
Disconnect
public abstract void Disconnect()
- Stop receiving msgs
Destroy
public abstract void Destroy()
- Deletes the channel
Cast
public abstract void Cast(byte msg[]) throws Exception
- Send to all members
Send
public abstract void Send(Object dest_addr,
byte msg[]) throws Exception
- Send to 1 member
Send
public abstract void Send(Vector dests,
byte msg[]) throws Exception
- Send to a subset of the members
Send
public abstract void Send(Message msg) throws Exception
- Send a message
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
GetMembers
public abstract Vector GetMembers()
- Get all members
GetNumMembers
public abstract int GetNumMembers()
- Get number of members connected to channel including caller
SetMembershipListener
public abstract void SetMembershipListener(MembershipListener listener)
GetAddress
public abstract Object GetAddress()
GetName
public abstract String GetName()
All Packages Class Hierarchy This Package Previous Next Index