Interface BayeuxServer

    • Field Detail

      • ATTRIBUTE

        static final java.lang.String ATTRIBUTE
        ServletContext attribute name used to obtain the Bayeux object
        See Also:
        Constant Field Values
    • Method Detail

      • getChannels

        java.util.List<ServerChannel> getChannels()
        Returns:
        the list of channels known to this BayeuxServer object
      • createChannelIfAbsent

        MarkedReference<ServerChannel> createChannelIfAbsent​(java.lang.String channelName,
                                                             ConfigurableServerChannel.Initializer... initializers)

        Creates a ServerChannel and initializes it atomically if the channel does not exist, or returns it if it already exists.

        This method can be used instead of adding a BayeuxServer.ChannelListener to atomically initialize a channel. The initializers will be called before any other thread can access the new channel instance.

        This method should be used when a channel needs to be initialized (e.g. by adding listeners) before any publish or subscribes can occur on the channel, or before any other thread may concurrently create the same channel.

        Parameters:
        channelName - the channel name
        initializers - the initializers invoked to configure the channel
        Returns:
        a MarkedReference whose reference is the channel, and the mark signals whether the channel has been created because it did not exist before.
      • getSession

        ServerSession getSession​(java.lang.String clientId)
        Parameters:
        clientId - the ServerSession identifier
        Returns:
        the ServerSession with the given clientId or null if no such valid session exists.
      • removeSession

        boolean removeSession​(ServerSession session)

        Removes the given session from this BayeuxServer.

        This method triggers the invocation of all listeners that would be called if the session was disconnected or if the session timed out.

        Parameters:
        session - the session to remove
        Returns:
        true if the session was known to this BayeuxServer and was removed
      • newLocalSession

        LocalSession newLocalSession​(java.lang.String idHint)

        Creates a new LocalSession.

        A LocalSession is a server-side ClientSession that allows server-side code to have special clients (resident within the same JVM) that can be used to publish and subscribe like a client-side session would do.

        Parameters:
        idHint - a hint to be included in the unique clientId of the session.
        Returns:
        a new LocalSession