org.granite.gravity
Class AbstractChannel
java.lang.Object
org.granite.gravity.AbstractChannel
- All Implemented Interfaces:
- Channel
- Direct Known Subclasses:
- AsyncChannel, ContinuationChannel, GenericChannel, JBossWebChannel, TomcatChannel, WebLogicChannel
public abstract class AbstractChannel
- extends Object
- implements Channel
- Author:
- Franck WOLFF
id
protected final String id
servletConfig
protected final ServletConfig servletConfig
subscriptions
protected final ConcurrentMap<String,Subscription> subscriptions
publishedQueue
protected LinkedList<AsyncPublishedMessage> publishedQueue
publishedQueueLock
protected final Lock publishedQueueLock
receivedQueue
protected LinkedList<AsyncMessage> receivedQueue
receivedQueueLock
protected final Lock receivedQueueLock
publisher
protected final AsyncPublisher publisher
receiver
protected final AsyncReceiver receiver
AbstractChannel
protected AbstractChannel(ServletConfig servletConfig,
GravityConfig gravityConfig,
String id)
hasAsyncHttpContext
protected abstract boolean hasAsyncHttpContext()
acquireAsyncHttpContext
protected abstract AsyncHttpContext acquireAsyncHttpContext()
releaseAsyncHttpContext
protected abstract void releaseAsyncHttpContext(AsyncHttpContext context)
getId
public String getId()
- Specified by:
getId in interface Channel
getGravity
public Gravity getGravity()
- Specified by:
getGravity in interface Channel
addSubscription
public Subscription addSubscription(String destination,
String subTopicId,
String subscriptionId,
boolean noLocal)
- Specified by:
addSubscription in interface Channel
getSubscriptions
public Collection<Subscription> getSubscriptions()
- Specified by:
getSubscriptions in interface Channel
removeSubscription
public Subscription removeSubscription(String subscriptionId)
- Specified by:
removeSubscription in interface Channel
publish
public void publish(AsyncPublishedMessage message)
throws MessagePublishingException
- Specified by:
publish in interface Channel
- Throws:
MessagePublishingException
hasPublishedMessage
public boolean hasPublishedMessage()
- Specified by:
hasPublishedMessage in interface Channel
runPublish
public boolean runPublish()
- Specified by:
runPublish in interface Channel
receive
public void receive(AsyncMessage message)
throws MessageReceivingException
- Specified by:
receive in interface Channel
- Throws:
MessageReceivingException
hasReceivedMessage
public boolean hasReceivedMessage()
- Specified by:
hasReceivedMessage in interface Channel
runReceive
public boolean runReceive()
- Specified by:
runReceive in interface Channel
runReceived
public boolean runReceived(AsyncHttpContext asyncHttpContext)
- Specified by:
runReceived in interface Channel
destroy
public void destroy()
- Specified by:
destroy in interface Channel
queueReceiver
protected boolean queueReceiver()
getServletConfig
protected ServletConfig getServletConfig()
getServletContext
protected ServletContext getServletContext()
equals
public boolean equals(Object obj)
- Overrides:
equals in class Object
hashCode
public int hashCode()
- Overrides:
hashCode in class Object
toString
public String toString()
- Overrides:
toString in class Object