Class ServerChannelImpl
- All Implemented Interfaces:
Channel
,ConfigurableServerChannel
,ServerChannel
,org.eclipse.jetty.util.component.Dumpable
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cometd.bayeux.server.ConfigurableServerChannel
ConfigurableServerChannel.Initializer, ConfigurableServerChannel.ServerChannelListener
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainer
Nested classes/interfaces inherited from interface org.cometd.bayeux.server.ServerChannel
ServerChannel.MessageListener, ServerChannel.SubscriptionListener
-
Field Summary
Fields inherited from interface org.cometd.bayeux.Channel
META, META_CONNECT, META_DISCONNECT, META_HANDSHAKE, META_SUBSCRIBE, META_UNSUBSCRIBE, SERVICE
Fields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAuthorizer
(Authorizer authorizer) Adds the givenAuthorizer
that grants or denies operations on this channel.void
protected List
<Authorizer> void
dump
(Appendable out, String indent) getAttribute
(String name) Retrieves the value of named channel attribute.getId()
long
boolean
A broadcasting channel is a channel that is neither ameta channel
nor aservice channel
.boolean
boolean
Tells whether a channel contains the deep wild characters '**', for example/foo/**
boolean
isLazy()
boolean
isMeta()
Tells whether the channel is a meta channel, that is if itsid
starts with"/meta/"
.boolean
boolean
Tells whether the channel is a service channel, that is if itsid
starts with"/service/"
.boolean
isWild()
Tells whether a channel contains the wild character '*', for example/foo/*
or if it isChannel.isDeepWild()
.void
Publishes the given information to this channel.void
publish
(Session from, ServerMessage.Mutable mutable, Promise<Boolean> promise) Publishes the given message to this channel, delivering the message to all theServerSession
s subscribed to this channel.void
remove()
Removes this channel, and all the children channels.removeAttribute
(String name) Removes a named channel attribute.void
removeAuthorizer
(Authorizer authorizer) Removes the givenAuthorizer
.void
void
setAttribute
(String name, Object value) Sets a named channel attribute value.void
setBroadcastToPublisher
(boolean broadcastToPublisher) Sets whether a publisher that is also a subscriber to the channel will receive the messages it publishes on that channel.void
setLazy
(boolean lazy) A lazy channel marks all messages published to it as lazy.void
setLazyTimeout
(long lazyTimeout) Sets the lazy timeout for this channel.void
setPersistent
(boolean persistent) A persistent channel is not removed when the last subscription is removedboolean
subscribe
(ServerSession session) Subscribes the given session to this channel.protected boolean
subscribe
(ServerSessionImpl session, ServerMessage message) protected boolean
sweep()
toString()
boolean
unsubscribe
(ServerSession session) Unsubscribes the given session from this channel.protected boolean
unsubscribe
(ServerSessionImpl session, ServerMessage message) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable
dump, dumpSelf
-
Constructor Details
-
ServerChannelImpl
-
-
Method Details
-
subscribe
Description copied from interface:ServerChannel
Subscribes the given session to this channel.
Subscriptions are effective for
broadcast channels
and are successful no-operations forservice channels
.The subscription may fail if the session is already subscribed to the channel or if the session is expired or if the channel is a meta channel.
- Specified by:
subscribe
in interfaceServerChannel
- Parameters:
session
- the session to subscribe- Returns:
- whether the subscription succeeded
- See Also:
-
subscribe
-
unsubscribe
Description copied from interface:ServerChannel
Unsubscribes the given session from this channel.
Unsubscriptions are effective for
broadcast channels
and are successful no-operations forservice channels
.The unsubscription may fail if the session is already unsubscribed from the channel or if the session is expired or if the channel is a meta channel.
- Specified by:
unsubscribe
in interfaceServerChannel
- Parameters:
session
- the session to unsubscribe- Returns:
- whether the unsubscription succeeded
-
unsubscribe
-
getSubscribers
- Specified by:
getSubscribers
in interfaceServerChannel
- Returns:
- a snapshot of the set of subscribers of this channel
-
subscribers
-
isBroadcast
public boolean isBroadcast()Description copied from interface:Channel
A broadcasting channel is a channel that is neither a
meta channel
nor aservice channel
.- Specified by:
isBroadcast
in interfaceChannel
- Returns:
- whether the channel is a broadcasting channel
-
isDeepWild
public boolean isDeepWild()Description copied from interface:Channel
Tells whether a channel contains the deep wild characters '**', for example
/foo/**
- Specified by:
isDeepWild
in interfaceChannel
- Returns:
- true if the channel contains the '**' characters
-
isLazy
public boolean isLazy()- Specified by:
isLazy
in interfaceConfigurableServerChannel
- Returns:
- whether the channel is lazy
- See Also:
-
isPersistent
public boolean isPersistent()- Specified by:
isPersistent
in interfaceConfigurableServerChannel
- Returns:
- whether the channel is persistent
- See Also:
-
isWild
public boolean isWild()Description copied from interface:Channel
Tells whether a channel contains the wild character '*', for example
/foo/*
or if it isChannel.isDeepWild()
. -
setLazy
public void setLazy(boolean lazy) Description copied from interface:ConfigurableServerChannel
A lazy channel marks all messages published to it as lazy.- Specified by:
setLazy
in interfaceConfigurableServerChannel
- Parameters:
lazy
- whether the channel is lazy- See Also:
-
getLazyTimeout
public long getLazyTimeout()- Specified by:
getLazyTimeout
in interfaceConfigurableServerChannel
- Returns:
- the lazy timeout for this channel
- See Also:
-
setLazyTimeout
public void setLazyTimeout(long lazyTimeout) Description copied from interface:ConfigurableServerChannel
Sets the lazy timeout for this channel. A positive value makes the channel lazy, a negative value makes the channel non-lazy.- Specified by:
setLazyTimeout
in interfaceConfigurableServerChannel
- Parameters:
lazyTimeout
- the lazy timeout for this channel- See Also:
-
setPersistent
public void setPersistent(boolean persistent) Description copied from interface:ConfigurableServerChannel
A persistent channel is not removed when the last subscription is removed- Specified by:
setPersistent
in interfaceConfigurableServerChannel
- Parameters:
persistent
- whether the channel is persistent- See Also:
-
addListener
- Specified by:
addListener
in interfaceConfigurableServerChannel
- Parameters:
listener
- the listener to add- See Also:
-
isBroadcastToPublisher
public boolean isBroadcastToPublisher()- Specified by:
isBroadcastToPublisher
in interfaceConfigurableServerChannel
- Returns:
- whether the channel broadcasts messages back to the publisher
-
setBroadcastToPublisher
public void setBroadcastToPublisher(boolean broadcastToPublisher) Description copied from interface:ConfigurableServerChannel
Sets whether a publisher that is also a subscriber to the channel will receive the messages it publishes on that channel.- Specified by:
setBroadcastToPublisher
in interfaceConfigurableServerChannel
- Parameters:
broadcastToPublisher
- whether the channel broadcasts messages back to the publisher
-
removeListener
- Specified by:
removeListener
in interfaceConfigurableServerChannel
- Parameters:
listener
- the listener to remove- See Also:
-
getListeners
- Specified by:
getListeners
in interfaceConfigurableServerChannel
- Returns:
- an immutable list of listeners
- See Also:
-
listeners
-
getChannelId
- Specified by:
getChannelId
in interfaceChannel
- Returns:
- The channel ID as a
ChannelId
-
getId
-
isMeta
-
isService
-
publish
Description copied from interface:ServerChannel
Publishes the given message to this channel, delivering the message to all the
ServerSession
s subscribed to this channel.- Specified by:
publish
in interfaceServerChannel
- Parameters:
from
- the session from which the message originatesmutable
- the message to publishpromise
- the promise to notify whether the message has been published- See Also:
-
publish
Description copied from interface:ServerChannel
Publishes the given information to this channel.
- Specified by:
publish
in interfaceServerChannel
- Parameters:
from
- the session from which the message originatesdata
- the data of the messagepromise
- the promise to notify whether the message has been published- See Also:
-
sweep
protected boolean sweep() -
remove
public void remove()Description copied from interface:ServerChannel
Removes this channel, and all the children channels.
If channel "/foo", "/foo/bar" and "/foo/blip" exist, removing channel "/foo" will remove also "/foo/bar" and "/foo/blip".
The removal will notify
BayeuxServer.ChannelListener
listeners.- Specified by:
remove
in interfaceServerChannel
-
setAttribute
Description copied from interface:Channel
Sets a named channel attribute value.
Channel attributes are convenience data that allows arbitrary application data to be associated with a channel.
- Specified by:
setAttribute
in interfaceChannel
- Parameters:
name
- the attribute namevalue
- the attribute value
-
getAttribute
Description copied from interface:Channel
Retrieves the value of named channel attribute.
- Specified by:
getAttribute
in interfaceChannel
- Parameters:
name
- the name of the attribute- Returns:
- the attribute value or null if the attribute is not present
-
getAttributeNames
- Specified by:
getAttributeNames
in interfaceChannel
- Returns:
- the channel attribute names.
-
removeAttribute
Description copied from interface:Channel
Removes a named channel attribute.
- Specified by:
removeAttribute
in interfaceChannel
- Parameters:
name
- the name of the attribute- Returns:
- the value of the attribute
-
addAuthorizer
Description copied from interface:ConfigurableServerChannel
Adds the given
Authorizer
that grants or denies operations on this channel.Operations must be granted by at least one Authorizer and must not be denied by any.
- Specified by:
addAuthorizer
in interfaceConfigurableServerChannel
- Parameters:
authorizer
- the Authorizer to add- See Also:
-
removeAuthorizer
Description copied from interface:ConfigurableServerChannel
Removes the given
Authorizer
.- Specified by:
removeAuthorizer
in interfaceConfigurableServerChannel
- Parameters:
authorizer
- the Authorizer to remove- See Also:
-
getAuthorizers
- Specified by:
getAuthorizers
in interfaceConfigurableServerChannel
- Returns:
- an immutable list of authorizers for this channel
-
authorizers
-
dump
- Specified by:
dump
in interfaceorg.eclipse.jetty.util.component.Dumpable
- Throws:
IOException
-
toString
-