Class AbstractClientSession

  • All Implemented Interfaces:
    ClientSession, org.cometd.bayeux.Session, org.eclipse.jetty.util.component.Dumpable

    public abstract class AbstractClientSession
    extends java.lang.Object
    implements ClientSession, org.eclipse.jetty.util.component.Dumpable

    Partial implementation of ClientSession.

    It handles extensions and batching, and provides utility methods to be used by subclasses.

    • Constructor Detail

      • AbstractClientSession

        protected AbstractClientSession()
    • Method Detail

      • newMessageId

        protected java.lang.String newMessageId()
      • extendOutgoing

        protected void extendOutgoing​(org.cometd.bayeux.Message.Mutable message,
                                      org.cometd.bayeux.Promise<java.lang.Boolean> promise)
      • extendIncoming

        protected void extendIncoming​(org.cometd.bayeux.Message.Mutable message,
                                      org.cometd.bayeux.Promise<java.lang.Boolean> promise)
      • newChannelId

        protected abstract org.cometd.bayeux.ChannelId newChannelId​(java.lang.String channelId)
      • startBatch

        public void startBatch()
        Specified by:
        startBatch in interface org.cometd.bayeux.Session
      • sendBatch

        protected abstract void sendBatch()
      • endBatch

        public boolean endBatch()
        Specified by:
        endBatch in interface org.cometd.bayeux.Session
      • batch

        public void batch​(java.lang.Runnable batch)
        Specified by:
        batch in interface org.cometd.bayeux.Session
      • isBatching

        protected boolean isBatching()
      • getAttribute

        public java.lang.Object getAttribute​(java.lang.String name)
        Specified by:
        getAttribute in interface org.cometd.bayeux.Session
      • getAttributeNames

        public java.util.Set<java.lang.String> getAttributeNames()
        Specified by:
        getAttributeNames in interface org.cometd.bayeux.Session
      • removeAttribute

        public java.lang.Object removeAttribute​(java.lang.String name)
        Specified by:
        removeAttribute in interface org.cometd.bayeux.Session
      • setAttribute

        public void setAttribute​(java.lang.String name,
                                 java.lang.Object value)
        Specified by:
        setAttribute in interface org.cometd.bayeux.Session
      • send

        protected abstract void send​(org.cometd.bayeux.Message.Mutable message)
      • newMessage

        protected org.cometd.bayeux.Message.Mutable newMessage()
      • resetSubscriptions

        protected void resetSubscriptions()
      • receive

        public void receive​(org.cometd.bayeux.Message.Mutable message,
                            org.cometd.bayeux.Promise<java.lang.Void> promise)

        Receives a message (from the server) and process it.

        Processing the message involves calling the receive extensions and the channel listeners.

        Parameters:
        message - the message received.
        promise - the promise notified of the receive processing
      • notifyListeners

        protected void notifyListeners​(org.cometd.bayeux.Message.Mutable message)
      • dump

        public void dump​(java.lang.Appendable out,
                         java.lang.String indent)
                  throws java.io.IOException
        Specified by:
        dump in interface org.eclipse.jetty.util.component.Dumpable
        Throws:
        java.io.IOException