|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ChannelServer
A remote interface for communicating channel events and other channel-related requests between peer channel services.
Each channel event (join, leave, send, close) is assigned a
timestamp when the event is added to the channel's event queue.
An event queue's current timestamp records the timestamp of the latest
send event that the queue has started to process. The initial event
timestamp is 1. A send event increments the next
timestamp, so all future join and leave events will have a later
timestamp. Because only a send event increments the next timestamp,
join, leave, and send requests may share the same timestamp. If a send
event at timestamp t is followed directly by a
series of join and leave events, the join and leave events will all
have the later timestamp t+1. The next send event
for the channel will also have timestamp t+1.
If a session becomes a channel member at a given timestamp
t, then it should receive all channel messages
with a timestamp greater than or equal to t. If a
session leaves a channel at a given timestamp t,
the session should receive channel messages up to timestamp
t-1, but should not receive channel messages
greater than or equal to timestamp t.
A channel server that receives a channel event notification (for delivery to a client session) uses the event's timestamp to determine whether the event needs to be delivered to a local session. The timestamp is used to determine duplicate events (in the case of coordinator recovery), and if a client session relocates, the session's current timestamp for a channel can be used to determine whether the session missed any channel messages while relocating.
| Nested Class Summary | |
|---|---|
static class |
ChannelServer.MembershipStatus
Membership status. |
| Method Summary | |
|---|---|
void |
close(BigInteger channelRefId,
long timestamp)
Notifies this server that the channel with the specified channelRefId is closed. |
BigInteger[] |
getSessions(BigInteger channelRefId)
Returns an array containing the client session ID of each client session on this node that is a member of the channel with the specified channelRefId. |
ChannelServer.MembershipStatus |
isMember(BigInteger channelRefId,
BigInteger sessionRefId)
If the session with the specified sessionRefId is connected to
the local node, returns ChannelServer.MembershipStatus.MEMBER if the session
is a member of the channel with the specified channelRefId and
returns ChannelServer.MembershipStatus.NON_MEMBER if the session is not a
member of the channel. |
boolean |
join(String name,
BigInteger channelRefId,
byte deliveryOrdinal,
long timestamp,
BigInteger sessionRefId)
Notifies this server that the locally-connected session with the specified sessionRefId has joined the channel with
the specified name and channelRefId. |
boolean |
leave(BigInteger channelRefId,
long timestamp,
BigInteger sessionRefId)
Notifies this server that the locally-connected session with the specified sessionRefId has left the channel with the
specified channelRefId. |
void |
relocateChannelMemberships(BigInteger sessionRefId,
long oldNodeId,
BigInteger[] channelRefIds,
byte[] deliveryOrdinals,
long[] msgTimestamps)
Notifies this server that the client session with the specified sessionRefId is relocating from the node (specified by
oldNodeId) to the new node (i.e., the local node) and that
the session's channel memberships should be updated accordingly. |
void |
relocateChannelMembershipsCompleted(BigInteger sessionRefId,
long newNodeId)
Notifies this server that the channel server on the node specified by newNodeId has completed updating the channel memberships
for the client session with the specified sessionRefId in
preparation for the session's relocation to the new node. |
void |
send(BigInteger channelRefId,
byte[] message,
long timestamp)
Sends the specified message to all locally-connected sessions that are members of the channel with the specified channelRefId. |
void |
serviceEventQueue(BigInteger channelRefId)
Notifies this server that it should service the event queue of the channel with the specified channelRefId. |
| Method Detail |
|---|
void serviceEventQueue(BigInteger channelRefId)
throws IOException
channelRefId.
channelRefId - a channel ID
IOException - if a communication problem occurs while
invoking this method
ChannelServer.MembershipStatus isMember(BigInteger channelRefId,
BigInteger sessionRefId)
throws IOException
sessionRefId is connected to
the local node, returns ChannelServer.MembershipStatus.MEMBER if the session
is a member of the channel with the specified channelRefId and
returns ChannelServer.MembershipStatus.NON_MEMBER if the session is not a
member of the channel. If the session is not connected to the local
node, then this method returns ChannelServer.MembershipStatus.UNKNOWN.
channelRefId - a channel IDsessionRefId - a session ID
sessionRefId for the channel with
the specified channelRefId
IOException - if a communication problem occurs while
invoking this method
boolean join(String name,
BigInteger channelRefId,
byte deliveryOrdinal,
long timestamp,
BigInteger sessionRefId)
throws IOException
sessionRefId has joined the channel with
the specified name and channelRefId.
name - a channel namechannelRefId - a channel IDdeliveryOrdinal - the channel's delivery requirement, as a Delivery ordinaltimestamp - the timestamp of the last channel message sentsessionRefId - a session ID
true if the join succeeded (either was delivered or
enqueued for a relocating session), and false if
the session is not locally connected and is not known to be
relocating
IOException - if a communication problem occurs while
invoking this method
boolean leave(BigInteger channelRefId,
long timestamp,
BigInteger sessionRefId)
throws IOException
sessionRefId has left the channel with the
specified channelRefId.
channelRefId - a channel IDtimestamp - the timestamp of the last channel message sentsessionRefId - a session ID
true if the leave succeeded (either was delivered or
enqueued for a relocating session), and false if
the session is not locally connected and is not known to be
relocating
IOException - if a communication problem occurs while
invoking this method
BigInteger[] getSessions(BigInteger channelRefId)
throws IOException
channelRefId.
channelRefId - a channel ID
IOException - if a communication problem occurs while
invoking this method
void send(BigInteger channelRefId,
byte[] message,
long timestamp)
throws IOException
channelRefId.
channelRefId - a channel IDmessage - a channel messagetimestamp - the message's timestamp
IOException - if a communication problem occurs while
invoking this method
void relocateChannelMemberships(BigInteger sessionRefId,
long oldNodeId,
BigInteger[] channelRefIds,
byte[] deliveryOrdinals,
long[] msgTimestamps)
throws IOException
sessionRefId is relocating from the node (specified by
oldNodeId) to the new node (i.e., the local node) and that
the session's channel memberships should be updated accordingly.
The channelRefIds array contains the channel ID of each
channel that the client session belongs to. The deliveryOrdinals array contains the delivery ordinal of each
corresponding channel. The msgTimestamps array contains the
timestamp of the latest message received by the specified session
(at the point that relocation started) for each corresponding
channel.
This server must update its local channel membership cache for the
specified session and add persistent membership information to
indicate that the specified session on the local node is now joined
to each channel. When the cache and persistent membership
information is updated, the relocateChannelMembershipsCompleted method should be invoked on the
old node's ChannelServer with the specified sessionRefId and the new node's ID.
sessionRefId - the ID of a client session relocating to the
local nodeoldNodeId - the ID of the node the session is relocating fromchannelRefIds - an array that contains the channel ID of each
channel that the client session is a member ofdeliveryOrdinals - an array that contains the delivery ordinal
of each channel that the client session is a member ofmsgTimestamps - an array that contains the message timestamp
of each channel that the client session is a member of
IOException - if a communication problem occurs while
invoking this method
void relocateChannelMembershipsCompleted(BigInteger sessionRefId,
long newNodeId)
throws IOException
newNodeId has completed updating the channel memberships
for the client session with the specified sessionRefId in
preparation for the session's relocation to the new node. This
method is invoked when the work associated with a previous
invocation to relocateChannelMemberships on the new node's channel server is
complete. This channel server should clean up any remaining
persistent channel membership information for the session on the old
node (i.e., the local node).
sessionRefId - the ID of a relocating client sessionnewNodeId - ID of the node the session is relocating to
IOException - if a communication problem occurs while
invoking this method
void close(BigInteger channelRefId,
long timestamp)
throws IOException
channelRefId is closed.
channelRefId - a channel IDtimestamp - the timestamp of the last channel message sent
IOException - if a communication problem occurs while
invoking this method
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||