Package org.apache.cayenne.remote
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
- 
Constructor SummaryConstructors Modifier Constructor Description protectedBaseConnection()Default constructor that initializes logging and a single threaded EventManager.
- 
Method SummaryModifier and Type Method Description protected abstract voidbeforeSendMessage(org.apache.cayenne.remote.ClientMessage message)Called before logging the beginning of message processing.protected abstract ObjectdoSendMessage(org.apache.cayenne.remote.ClientMessage message)The worker method invoked to process message.longgetProcessedMessagesCount()Returns a count of processed messages since the beginning of life of this connector.ObjectsendMessage(org.apache.cayenne.remote.ClientMessage message)Invokes 'beforeSendMessage' on self, then invokes 'doSendMessage'.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cayenne.remote.ClientConnectiongetServerEventBridge
- 
Field Details- 
loggerprotected org.slf4j.Logger logger
- 
messageIdprotected long messageId
 
- 
- 
Constructor Details- 
BaseConnectionprotected BaseConnection()Default constructor that initializes logging and a single threaded EventManager.
 
- 
- 
Method Details- 
sendMessagepublic Object sendMessage(org.apache.cayenne.remote.ClientMessage message) throws CayenneRuntimeExceptionInvokes '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:
- sendMessagein interface- ClientConnection
- Throws:
- CayenneRuntimeException
 
- 
getProcessedMessagesCountpublic long getProcessedMessagesCount()Returns a count of processed messages since the beginning of life of this connector.
- 
beforeSendMessageprotected abstract void beforeSendMessage(org.apache.cayenne.remote.ClientMessage message) throws CayenneRuntimeExceptionCalled before logging the beginning of message processing.- Throws:
- CayenneRuntimeException
 
- 
doSendMessageprotected abstract Object doSendMessage(org.apache.cayenne.remote.ClientMessage message) throws CayenneRuntimeExceptionThe worker method invoked to process message.- Throws:
- CayenneRuntimeException
 
 
-