Common Network Layer InterfacePage edited by Aidan SkinnerPurposeThis design page describes the low level design for the new interface which is aimed at facilitating encapsulation for the Network code in both the Java Broker & Client. This is the first step in decoupling the exsiting IO layer from both the surrounding Qpid code and more specifically from the current tie-in to MINA. This document will provide sufficient information for architecture review and also for input to task breakdown & planning. Interface Requirements
Design DetailsCurrent InterfaceCurrently ...... (Add description of current transport code, including packages/key classes/major problem areas are) Data FlowAt the start of a connection the the NetworkDriver will pass data to a ProtocolFactory which will handle protocol negotiation and return the ProtocolDriver to use or throw an exception if no driver is available. The network driver will call bytesReceived on the ProtocolDriver when data is recieved. Control lies primarily with the network driver. Data comes in from the operating system, is read from the socket by the network driver and given to the protocol drivers bytesReceived method. If the bytes represent the completion of an AMQP frame the ProtocolDriver calls the handler for that frame. The frame handler may request a frame to be written in response, in which case it places the frame in the ProtocolDriver which signals to the NetworkDriver that it has data to be written. New InterfaceSkeleton code for the new interface objects is outline below, for illustrative purposes.
public interface ProtocolDriver
{
int bytesReceived(byte[] bytes, int offset, int length);
byte[] bytesRead();
// Called when the connection has been idle
void idle();
void close();
void halfclose();
void setDataReadyHandler(ProtocolDriverDataListener listener);
}
public class AMQProtocolDriver implements ProtocolDriver
{
int bytesReceived(byte[] bytes, int offset, int length)
{
// Parses bytes until it figures out which ProtocolDriver to use, constructs one and then passes through all data and other method calls.
}
}
public interface ProtocolDriverDataListener
{
// Called by the ProtocolDriver when it has data ready to be written
void protocolDriverDataReady();
}
public interface NetworkDriver implements ProtocolDriverDataListener
{
void open(InetAddress destination);
void bind(int port, InetAddress[] addresses);
void close();
// Returns number of bytes actually accepted
int write(byte[] bytes, int offset, int length);
// Use the preconfigured SSLEngine
void setSSLEngine(SSLEngine engine);
void setNetworkDriverConfiguration(NetworkDriverConfiguration config);
void protocolDriverDataReady();
}
public interface NetworkDriverConfiguration
{
// Taken from Socket
void getKeepAlive(boolean on)
void getOOBInline(boolean on)
void getReceiveBufferSize(int size)
void getReuseAddress(boolean on)
void getSendBufferSize(int size)
void getSoLinger(boolean on, int linger)
void getSoTimeout(int timeout)
void getTcpNoDelay(boolean on)
void getTrafficClass(int tc)
void getReceiveBufferSize(int size);
void getSendBufferSize(int size);
}
Change Notification Preferences
View Online
|
View Change
|
Add Comment
|
- [CONF] Apache Qpid > Common Network Layer Interface confluence
- [CONF] Apache Qpid > Common Network Layer Interface confluence
- [CONF] Apache Qpid > Common Network Layer Interface confluence
- [CONF] Apache Qpid > Common Network Layer Interface confluence
- [CONF] Apache Qpid > Common Network Layer Interface confluence
- [CONF] Apache Qpid > Common Network Layer Interface confluence
- [CONF] Apache Qpid > Common Network Layer Interface confluence
- [CONF] Apache Qpid > Common Network Layer Interface confluence
- [CONF] Apache Qpid > Common Network Layer Interface confluence
- [CONF] Apache Qpid > Common Network Layer Interface confluence
- [CONF] Apache Qpid > Common Network Layer Interface confluence
- [CONF] Apache Qpid > Common Network Layer Interface confluence
- [CONF] Apache Qpid > Common Network Layer Interface confluence
- [CONF] Apache Qpid > Common Network Layer Interface confluence
