Class AbstractService

Direct Known Subclasses:

public abstract class AbstractService extends Object

AbstractService provides convenience methods to assist with the creation of a CometD services.

A CometD service runs application code whenever a message is received on a particular channel.

Specifically it provides:

  • Mapping of channel subscriptions to method invocation on the derived service class.
  • Optional use of a thread pool used for method invocation if handling can take considerable time and it is desired not to hold up the delivering thread (typically a HTTP request handling thread).
  • The objects returned from method invocation are delivered back to the calling client in a private message.

Subclasses should call addService(String, String) in order to map channel subscriptions to method invocations, usually in the subclass constructor.

Each CometD service has an associated LocalSession that can be used as the source for messages published via ServerChannel.publish(Session, ServerMessage.Mutable, Promise) or ServerSession.deliver(Session, ServerMessage.Mutable, Promise).

See Also: