public class MultiplexHChannelManager extends AbstractHChannelManager
| Modifier and Type | Field and Description |
|---|---|
protected CleanupChannelMap<TopicSubscriber> |
sub2Channels |
protected CleanupChannelMap<InetSocketAddress> |
subscriptionChannels |
protected ConcurrentMap<TopicSubscriber,MessageHandler> |
topicSubscriber2MessageHandler |
closed, closedLock, globalCounter, host2NonSubscriptionChannels, host2Topics, socketFactory, topic2Host| Constructor and Description |
|---|
MultiplexHChannelManager(ClientConfiguration cfg,
org.jboss.netty.channel.ChannelFactory socketFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
asyncCloseSubscription(TopicSubscriber topicSubscriber,
Callback<PubSubProtocol.ResponseBody> callback,
Object context)
Close the subscription of the given
topicSubscriber. |
protected void |
checkTimeoutRequestsOnSubscriptionChannels()
Chekout the pub/sub requests on subscription channels.
|
protected void |
closeSubscriptionChannels()
Close all subscription channels when close channel manager.
|
protected HChannel |
createAndStoreSubscriptionChannel(org.jboss.netty.channel.Channel channel)
Create and store a subscription
HChannel thru the underlying established
channel |
protected HChannel |
createAndStoreSubscriptionChannel(InetSocketAddress host)
Create and store a subscription
HChannel to target host. |
SubscribeResponseHandler |
getSubscribeResponseHandler(TopicSubscriber topicSubscriber)
Get the subscribe response handler managed the given
topicSubscriber. |
protected HChannel |
getSubscriptionChannel(InetSocketAddress host)
Is there a subscription
HChannel existed for a given host. |
protected HChannel |
getSubscriptionChannel(TopicSubscriber subscriber) |
protected HChannel |
getSubscriptionChannelByTopicSubscriber(TopicSubscriber subscriber)
Get a subscription channel for a given
topicSubscriber. |
protected ClientChannelPipelineFactory |
getSubscriptionChannelPipelineFactory() |
protected void |
onSubscriptionChannelDisconnected(InetSocketAddress host,
org.jboss.netty.channel.Channel channel)
Handle the disconnected event from a subscription
HChannel. |
protected boolean |
removeSubscriptionChannel(TopicSubscriber topicSubscriber,
HChannel channel) |
protected void |
restartDelivery(TopicSubscriber topicSubscriber) |
void |
startDelivery(TopicSubscriber topicSubscriber,
MessageHandler messageHandler)
Start delivering messages for a given topic subscriber.
|
void |
stopDelivery(TopicSubscriber topicSubscriber)
Stop delivering messages for a given topic subscriber.
|
protected Either<Boolean,HChannel> |
storeSubscriptionChannel(TopicSubscriber topicSubscriber,
PubSubData txn,
HChannel channel) |
clearAllTopicsForHost, clearHostForTopic, close, getChannelFactory, getConsumeCallback, getNonSubscriptionChannelPipelineFactory, getSslFactory, getSubscriptionEventEmitter, isClosed, nextTxnId, onNonSubscriptionChannelDisconnected, redirectToHost, schedule, storeTopic2HostMapping, submitOp, submitOpAfterDelay, submitOpToDefaultServerprotected final CleanupChannelMap<InetSocketAddress> subscriptionChannels
protected final CleanupChannelMap<TopicSubscriber> sub2Channels
protected final ConcurrentMap<TopicSubscriber,MessageHandler> topicSubscriber2MessageHandler
public MultiplexHChannelManager(ClientConfiguration cfg, org.jboss.netty.channel.ChannelFactory socketFactory)
protected ClientChannelPipelineFactory getSubscriptionChannelPipelineFactory()
getSubscriptionChannelPipelineFactory in class AbstractHChannelManagerprotected HChannel createAndStoreSubscriptionChannel(org.jboss.netty.channel.Channel channel)
AbstractHChannelManagerHChannel thru the underlying established
channelcreateAndStoreSubscriptionChannel in class AbstractHChannelManagerchannel - The underlying established subscription channel.protected HChannel createAndStoreSubscriptionChannel(InetSocketAddress host)
AbstractHChannelManagerHChannel to target host.createAndStoreSubscriptionChannel in class AbstractHChannelManagerhost - Target host address.protected HChannel getSubscriptionChannel(InetSocketAddress host)
AbstractHChannelManagerHChannel existed for a given host.getSubscriptionChannel in class AbstractHChannelManagerhost - Target host address.protected HChannel getSubscriptionChannel(TopicSubscriber subscriber)
protected HChannel getSubscriptionChannelByTopicSubscriber(TopicSubscriber subscriber)
AbstractHChannelManagertopicSubscriber.getSubscriptionChannelByTopicSubscriber in class AbstractHChannelManagersubscriber - Topic Subscribertopic's owner is unknown, return null.
if topic's owner is know and there is a channel
existed before, return the existed channel, otherwise created
a new one for the topicSubscriber.protected void onSubscriptionChannelDisconnected(InetSocketAddress host, org.jboss.netty.channel.Channel channel)
AbstractHChannelManagerHChannel.onSubscriptionChannelDisconnected in class AbstractHChannelManagerhost - Which host is disconnected.channel - The underlying established channel.public SubscribeResponseHandler getSubscribeResponseHandler(TopicSubscriber topicSubscriber)
HChannelManagertopicSubscriber.topicSubscriber - Topic Subscriberpublic void startDelivery(TopicSubscriber topicSubscriber, MessageHandler messageHandler) throws PubSubException.ClientNotSubscribedException, AlreadyStartDeliveryException
HChannelManagertopicSubscriber - Topic SubscribermessageHandler - MessageHandler to register for this ResponseHandler instance.PubSubException.ClientNotSubscribedException - If the client is not currently subscribed to the topicAlreadyStartDeliveryException - If someone started delivery a message handler before stopping existed one.protected void restartDelivery(TopicSubscriber topicSubscriber) throws PubSubException.ClientNotSubscribedException, AlreadyStartDeliveryException
restartDelivery in class AbstractHChannelManagerPubSubException.ClientNotSubscribedExceptionAlreadyStartDeliveryExceptionpublic void stopDelivery(TopicSubscriber topicSubscriber) throws PubSubException.ClientNotSubscribedException
HChannelManagertopicSubscriber - Topic SubscriberPubSubException.ClientNotSubscribedException - If the client is not currently subscribed to the topicpublic void asyncCloseSubscription(TopicSubscriber topicSubscriber, Callback<PubSubProtocol.ResponseBody> callback, Object context)
HChannelManagertopicSubscriber.topicSubscriber - Topic Subscribercallback - Callbackcontext - Callback contextprotected void checkTimeoutRequestsOnSubscriptionChannels()
AbstractHChannelManagercheckTimeoutRequestsOnSubscriptionChannels in class AbstractHChannelManagerprotected void closeSubscriptionChannels()
AbstractHChannelManagercloseSubscriptionChannels in class AbstractHChannelManagerprotected Either<Boolean,HChannel> storeSubscriptionChannel(TopicSubscriber topicSubscriber, PubSubData txn, HChannel channel)
protected boolean removeSubscriptionChannel(TopicSubscriber topicSubscriber, HChannel channel)
Copyright © 2011–2021 The Apache Software Foundation. All rights reserved.