|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.service.channel.ChannelImpl
final class ChannelImpl
Channel implementation for use within a single transaction.
This implementation uses several BindingKeyedCollections
as follows:
channelsMap "com.sun.sgs.impl.service.channel.name." nameChannelImpl
ChannelImpl
by name.
eventQueuesMap "com.sun.sgs.impl.service.channel.eventQueue."coordinatorNodeId. channelId (as string form of
BigInteger)EventQueue
savedMessagesMap "com.sun.sgs.impl.service.channel.message."channelId. timestamp (as string form of
Long)ChannelMessageInfo
| Nested Class Summary | |
|---|---|
(package private) static class |
ChannelImpl.ChannelEvent
Represents an event on a channel. |
(package private) static class |
ChannelImpl.ChannelMessageInfo
Contains a saved channel message with its associated timestamp and expiration time. |
(package private) static class |
ChannelImpl.ReassignCoordinatorsTask
A persistent task to reassign channel coordinators on a failed node to another node. |
(package private) static class |
ChannelImpl.RemoveFailedNodeFromLocalChannelsTask
A persistent task to remove a failed node, from locally coordinated channels. |
(package private) static class |
ChannelImpl.SendEvent
A channel send event. |
| Field Summary | |
|---|---|
(package private) BigInteger |
channelRefId
The ID from a managed reference to this instance. |
(package private) static String |
CHANNELS_MAP_PREFIX
The channels map prefix. |
(package private) static Set<BigInteger> |
EMPTY_CHANNEL_MEMBERSHIP
The empty channel membership set. |
(package private) static String |
EVENT_QUEUE_MAP_PREFIX
An event queue map prefix. |
(package private) static String |
SAVED_MESSAGES_MAP_PREFIX
The saved messages map prefix. |
| Method Summary | |
|---|---|
(package private) void |
addServerNodeId(long nodeId)
Adds the specified nodeId to the set of server nodes for
this channel. |
(package private) void |
close(boolean removeName)
Enqueues a close event to this channel's event queue and notifies this channel's coordinator to service the event. |
boolean |
equals(Object obj)
|
(package private) List<ChannelImpl.ChannelMessageInfo> |
getChannelMessages(long fromTimestamp,
long toTimestamp)
Returns a list containing saved channel messages (if any) with timestamps between fromTimestamp and toTimestamp
inclusive. |
(package private) long |
getCurrentMessageTimestamp()
Returns the message timestamp of the last message processed by this channel. |
(package private) Delivery |
getDelivery()
Implements Channel.getDelivery(). |
(package private) static Channel |
getInstance(String name)
Returns a channel with the given name. |
(package private) String |
getName()
Implements Channel.getName(). |
(package private) Iterator<ClientSession> |
getSessions()
Implements Channel.getSessions(). |
(package private) static void |
handleChannelMessage(BigInteger channelRefId,
ClientSession sender,
ByteBuffer message)
Handles a channel message that the specified sender
is sending on the channel with the specified channelRefId. |
int |
hashCode()
|
(package private) boolean |
hasSessions()
Implements Channel.hasSessions(). |
(package private) boolean |
isClosed()
Returns true if the channel is closed, and false
otherwise. |
(package private) boolean |
isCoordinator()
Returns true if this node is the coordinator for this
channel, otherwise returns false. |
(package private) void |
join(ClientSession session)
Implements Channel.join(ClientSession). |
(package private) void |
join(Set<? extends ClientSession> sessions)
Implements Channel.join(Set). |
(package private) void |
leave(ClientSession session)
Implements Channel.leave(ClientSession). |
(package private) void |
leave(Set<? extends ClientSession> sessions)
Implements Channel.leave(Set). |
(package private) void |
leaveAll()
Implements Channel.leaveAll(). |
(package private) static Channel |
newInstance(String name,
ChannelListener listener,
Delivery delivery,
int writeBufferCapacity)
Constructs a new Channel with the given name, listener, delivery guarantee and write-buffer capacity. |
(package private) void |
removeServerNodeId(long nodeId)
Removes the specified nodeId from the set of server nodes
for this channel. |
(package private) void |
send(ClientSession sender,
ByteBuffer message)
Implements Channel.send(ClientSession,ByteBuffer). |
(package private) static void |
serviceEventQueue(BigInteger channelRefId)
Services the event queue for the channel with the specified channelRefId. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
static final String CHANNELS_MAP_PREFIX
static final String EVENT_QUEUE_MAP_PREFIX
static final String SAVED_MESSAGES_MAP_PREFIX
static final Set<BigInteger> EMPTY_CHANNEL_MEMBERSHIP
final BigInteger channelRefId
| Method Detail |
|---|
static Channel newInstance(String name,
ChannelListener listener,
Delivery delivery,
int writeBufferCapacity)
Channel with the given name, listener, delivery guarantee and write-buffer capacity.
static Channel getInstance(String name)
name.
String getName()
Channel.getName().
Delivery getDelivery()
Channel.getDelivery().
boolean hasSessions()
Channel.hasSessions().
Iterator<ClientSession> getSessions()
Channel.getSessions().
void join(ClientSession session)
Channel.join(ClientSession).
void join(Set<? extends ClientSession> sessions)
Channel.join(Set).
Enqueues a join event to this channel's event queue and notifies
this channel's coordinator to service the event.
long getCurrentMessageTimestamp()
void leave(ClientSession session)
Channel.leave(ClientSession).
Enqueues a leave event to this channel's event queue and notifies
this channel's coordinator to service the event.
void leave(Set<? extends ClientSession> sessions)
Channel.leave(Set).
Enqueues leave event(s) to this channel's event queue and notifies
this channel's coordinator to service the event(s).
void leaveAll()
Channel.leaveAll().
Closes the current channel, and creates a new channel (with a new
channel ID) that uses the existing channel's wrapper. Since the
application still uses the same channel wrapper for this channel,
the application is not effected.
void send(ClientSession sender,
ByteBuffer message)
Channel.send(ClientSession,ByteBuffer).
Enqueues a send event to this channel's event queue and notifies
this channel's coordinator to service the event.
void close(boolean removeName)
true by this channel's ChannelWrapper
when the application removes the wrapper object, and is invoked with
false by this channel when the application invokes the
leaveAll() method.
removeName - if true, the channel's name binding
is removed when the channel's persistent structures
are cleaned up, otherwise, the channel's name binding is
not removedpublic boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Objectboolean isClosed()
true if the channel is closed, and false
otherwise.
boolean isCoordinator()
true if this node is the coordinator for this
channel, otherwise returns false.
void addServerNodeId(long nodeId)
nodeId to the set of server nodes for
this channel.
nodeId - a server node's IDvoid removeServerNodeId(long nodeId)
nodeId from the set of server nodes
for this channel.
nodeId - a server node's ID
List<ChannelImpl.ChannelMessageInfo> getChannelMessages(long fromTimestamp,
long toTimestamp)
fromTimestamp and toTimestamp
inclusive. If fromTimestamp is greater than toTimestamp this method returns null.
static void handleChannelMessage(BigInteger channelRefId,
ClientSession sender,
ByteBuffer message)
message that the specified sender
is sending on the channel with the specified channelRefId.
channelRefId - the channel ID, as a BigIntegersender - the client session sending the channel messagemessage - the channel messagestatic void serviceEventQueue(BigInteger channelRefId)
channelRefId.
|
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 | |||||||||