Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.remote
Class BaseConnection

    java.lang.Object
      org.apache.cayenne.remote.BaseConnection

All Implemented Interfaces:
  ClientConnection

Direct Known Subclasses:
  HessianConnection, LocalConnection

    public abstract class BaseConnection

extends java.lang.Object
implements ClientConnection

A common base class for concrete ClientConnection implementations. Provides message logging functionality via commons-logging.

Since:
  1.2

Field Summary
`protected org.apache.commons.logging.Log` | `logger`
`protected long` | `messageId`
`protected long` | `readTimeout`

Constructor Summary
`protected` | `BaseConnection()` Default constructor that initializes logging and a single threaded EventManager.

Method Summary
`protected abstract void` | `beforeSendMessage(ClientMessage message)` Called before logging the beginning of message processing.
`protected abstract java.lang.Object` | `doSendMessage(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.
`long` | `getReadTimeout()` The socket timeout on requests in milliseconds.
`java.lang.Object` | `sendMessage(ClientMessage message)` Invokes 'beforeSendMessage' on self, then invokes 'doSendMessage'.
`void` | `setReadTimeout(long readTimeout)` Sets the socket timeout.

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 Detail

### logger

    protected org.apache.commons.logging.Log logger

### messageId

    protected long messageId

### readTimeout

    protected long readTimeout

Constructor Detail

### BaseConnection

    protected BaseConnection()

  Default constructor that initializes logging and a single threaded EventManager.

Method Detail

### sendMessage

    public java.lang.Object sendMessage(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.

### getReadTimeout

    public long getReadTimeout()

  The socket timeout on requests in milliseconds. Defaults to infinity.

  Since:
    3.1

### setReadTimeout

    public void setReadTimeout(long readTimeout)

  Sets the socket timeout.

  Parameters:
    `readTimeout` - The socket timeout on requests in milliseconds.
  Since:
    3.1

### beforeSendMessage

    protected abstract void beforeSendMessage(ClientMessage message)
                                       throws CayenneRuntimeException

  Called before logging the beginning of message processing.

  Throws:
    `CayenneRuntimeException`

### doSendMessage

    protected abstract java.lang.Object doSendMessage(ClientMessage message)
                                               throws CayenneRuntimeException

  The worker method invoked to process message.

  Throws:
    `CayenneRuntimeException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2012 Apache Cayenne. All Rights Reserved.