public abstract class AbstractChannel extends Object implements Channel
| Modifier and Type | Field and Description |
|---|---|
protected String |
clientType |
protected ChannelFactory<? extends Channel> |
factory |
protected Gravity |
gravity |
protected AsyncReceiver |
httpReceiver |
protected String |
id |
protected LinkedList<AsyncPublishedMessage> |
publishedQueue |
protected Lock |
publishedQueueLock |
protected AsyncPublisher |
publisher |
protected LinkedList<AsyncMessage> |
receivedQueue |
protected Lock |
receivedQueueLock |
protected String |
sessionId |
protected ConcurrentMap<String,Subscription> |
subscriptions |
protected UdpReceiver |
udpReceiver |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractChannel(Gravity gravity,
String id,
ChannelFactory<? extends Channel> factory,
String clientType) |
protected final String clientType
protected final ChannelFactory<? extends Channel> factory
protected final ConcurrentMap<String,Subscription> subscriptions
protected LinkedList<AsyncPublishedMessage> publishedQueue
protected final Lock publishedQueueLock
protected LinkedList<AsyncMessage> receivedQueue
protected final Lock receivedQueueLock
protected final AsyncPublisher publisher
protected final AsyncReceiver httpReceiver
protected UdpReceiver udpReceiver
protected AbstractChannel(Gravity gravity, String id, ChannelFactory<? extends Channel> factory, String clientType)
protected abstract boolean hasAsyncHttpContext()
protected abstract AsyncHttpContext acquireAsyncHttpContext()
protected abstract void releaseAsyncHttpContext(AsyncHttpContext context)
public String getClientType()
getClientType in interface Channelpublic ChannelFactory<? extends Channel> getFactory()
getFactory in interface Channelpublic Gravity getGravity()
getGravity in interface Channelpublic Subscription addSubscription(String destination, String subTopicId, String subscriptionId, boolean noLocal)
addSubscription in interface Channelpublic Collection<Subscription> getSubscriptions()
getSubscriptions in interface Channelpublic Subscription removeSubscription(String subscriptionId)
removeSubscription in interface Channelpublic void publish(AsyncPublishedMessage message) throws MessagePublishingException
publish in interface ChannelMessagePublishingExceptionpublic boolean hasPublishedMessage()
hasPublishedMessage in interface Channelpublic boolean runPublish()
runPublish in interface Channelpublic void receive(AsyncMessage message) throws MessageReceivingException
receive in interface ChannelMessageReceivingExceptionpublic boolean hasReceivedMessage()
hasReceivedMessage in interface Channelpublic boolean runReceive()
runReceive in interface Channelpublic ObjectOutput newSerializer(GraniteContext context, OutputStream os)
public String getSerializerContentType()
protected void createUdpReceiver(UdpReceiverFactory factory, AsyncHttpContext asyncHttpContext)
public boolean runReceived(AsyncHttpContext asyncHttpContext)
runReceived in interface Channelpublic void destroy()
protected boolean queueReceiver()