Class BaseConnection

java.lang.Object
org.apache.cayenne.remote.BaseConnection
All Implemented Interfaces:
ClientConnection
Direct Known Subclasses:
HttpClientConnection, LocalConnection

public abstract class BaseConnection
extends Object
implements ClientConnection
A common base class for concrete ClientConnection implementations. Provides message logging functionality via slf4j logging.
Since:
1.2
  • Field Summary

    Fields
    Modifier and Type Field Description
    protected org.slf4j.Logger logger  
    protected long messageId  
  • Constructor Summary

    Constructors
    Modifier Constructor Description
    protected BaseConnection()
    Default constructor that initializes logging and a single threaded EventManager.
  • Method Summary

    Modifier and Type Method Description
    protected abstract void beforeSendMessage​(org.apache.cayenne.remote.ClientMessage message)
    Called before logging the beginning of message processing.
    protected abstract Object doSendMessage​(org.apache.cayenne.remote.ClientMessage message)
    The worker method invoked to process message.
    long getProcessedMessagesCount()
    Returns a count of processed messages since the beginning of life of this connector.
    Object sendMessage​(org.apache.cayenne.remote.ClientMessage message)
    Invokes 'beforeSendMessage' on self, then invokes 'doSendMessage'.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.cayenne.remote.ClientConnection

    getServerEventBridge
  • Field Details

    • logger

      protected org.slf4j.Logger logger
    • messageId

      protected long messageId
  • Constructor Details

    • BaseConnection

      protected BaseConnection()
      Default constructor that initializes logging and a single threaded EventManager.
  • Method Details

    • sendMessage

      public Object sendMessage​(org.apache.cayenne.remote.ClientMessage message) throws CayenneRuntimeException
      Invokes 'beforeSendMessage' on self, then invokes 'doSendMessage'. Implements basic logging functionality. Do not override this method unless absolutely necessary. Override 'beforeSendMessage' and 'doSendMessage' instead.
      Specified by:
      sendMessage in interface ClientConnection
      Throws:
      CayenneRuntimeException
    • getProcessedMessagesCount

      public long getProcessedMessagesCount()
      Returns a count of processed messages since the beginning of life of this connector.
    • beforeSendMessage

      protected abstract void beforeSendMessage​(org.apache.cayenne.remote.ClientMessage message) throws CayenneRuntimeException
      Called before logging the beginning of message processing.
      Throws:
      CayenneRuntimeException
    • doSendMessage

      protected abstract Object doSendMessage​(org.apache.cayenne.remote.ClientMessage message) throws CayenneRuntimeException
      The worker method invoked to process message.
      Throws:
      CayenneRuntimeException