org.apache.qpid.transport.network.mina
Class MINANetworkDriver

java.lang.Object
  extended by org.apache.mina.common.IoHandlerAdapter
      extended by org.apache.qpid.transport.network.mina.MINANetworkDriver
All Implemented Interfaces:
org.apache.mina.common.IoHandler, NetworkDriver, Sender<ByteBuffer>

public class MINANetworkDriver
extends org.apache.mina.common.IoHandlerAdapter
implements NetworkDriver


Field Summary
(package private)  ProtocolEngine _protocolEngine
           
 
Constructor Summary
MINANetworkDriver()
           
MINANetworkDriver(boolean useNIO, int processors, boolean executorPool, boolean protectIO)
           
MINANetworkDriver(boolean useNIO, int processors, boolean executorPool, boolean protectIO, ProtocolEngine protocolEngine, org.apache.mina.common.IoSession session)
           
MINANetworkDriver(org.apache.mina.common.IoConnector ioConnector)
           
MINANetworkDriver(org.apache.mina.common.IoConnector ioConnector, ProtocolEngine engine)
           
 
Method Summary
 void bind(int port, InetAddress[] addresses, ProtocolEngineFactory factory, NetworkDriverConfiguration config, SSLContextFactory sslFactory)
           
 void close()
           
 void exceptionCaught(org.apache.mina.common.IoSession protocolSession, Throwable throwable)
           
 void flush()
           
 SocketAddress getLocalAddress()
           
 SocketAddress getRemoteAddress()
           
 void messageReceived(org.apache.mina.common.IoSession protocolSession, Object message)
          Invoked when a message is received on a particular protocol session.
 void open(int port, InetAddress destination, ProtocolEngine engine, NetworkDriverConfiguration config, SSLContextFactory sslFactory)
           
 void send(ByteBuffer msg)
           
 void sessionClosed(org.apache.mina.common.IoSession protocolSession)
           
 void sessionCreated(org.apache.mina.common.IoSession protocolSession)
           
 void sessionIdle(org.apache.mina.common.IoSession session, org.apache.mina.common.IdleStatus status)
           
 void setIdleTimeout(int i)
           
 void setMaxReadIdle(int idleTime)
          The length of time after which the ProtocolEngines readIdle() method should be called if no data has been read in seconds
 void setMaxWriteIdle(int idleTime)
          The length of time after which the ProtocolEngines writeIdle() method should be called if no data has been written in seconds
 void setProtocolEngine(ProtocolEngine protocolEngine)
           
 void setProtocolEngineFactory(ProtocolEngineFactory engineFactory, boolean acceptingConnections)
           
 
Methods inherited from class org.apache.mina.common.IoHandlerAdapter
messageSent, sessionOpened
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_protocolEngine

ProtocolEngine _protocolEngine
Constructor Detail

MINANetworkDriver

public MINANetworkDriver(boolean useNIO,
                         int processors,
                         boolean executorPool,
                         boolean protectIO)

MINANetworkDriver

public MINANetworkDriver(boolean useNIO,
                         int processors,
                         boolean executorPool,
                         boolean protectIO,
                         ProtocolEngine protocolEngine,
                         org.apache.mina.common.IoSession session)

MINANetworkDriver

public MINANetworkDriver()

MINANetworkDriver

public MINANetworkDriver(org.apache.mina.common.IoConnector ioConnector)

MINANetworkDriver

public MINANetworkDriver(org.apache.mina.common.IoConnector ioConnector,
                         ProtocolEngine engine)
Method Detail

bind

public void bind(int port,
                 InetAddress[] addresses,
                 ProtocolEngineFactory factory,
                 NetworkDriverConfiguration config,
                 SSLContextFactory sslFactory)
          throws BindException
Specified by:
bind in interface NetworkDriver
Throws:
BindException

getRemoteAddress

public SocketAddress getRemoteAddress()
Specified by:
getRemoteAddress in interface NetworkDriver

getLocalAddress

public SocketAddress getLocalAddress()
Specified by:
getLocalAddress in interface NetworkDriver

open

public void open(int port,
                 InetAddress destination,
                 ProtocolEngine engine,
                 NetworkDriverConfiguration config,
                 SSLContextFactory sslFactory)
          throws OpenException
Specified by:
open in interface NetworkDriver
Throws:
OpenException

setMaxReadIdle

public void setMaxReadIdle(int idleTime)
Description copied from interface: NetworkDriver
The length of time after which the ProtocolEngines readIdle() method should be called if no data has been read in seconds

Specified by:
setMaxReadIdle in interface NetworkDriver

setMaxWriteIdle

public void setMaxWriteIdle(int idleTime)
Description copied from interface: NetworkDriver
The length of time after which the ProtocolEngines writeIdle() method should be called if no data has been written in seconds

Specified by:
setMaxWriteIdle in interface NetworkDriver

close

public void close()
Specified by:
close in interface Sender<ByteBuffer>

flush

public void flush()
Specified by:
flush in interface Sender<ByteBuffer>

send

public void send(ByteBuffer msg)
Specified by:
send in interface Sender<ByteBuffer>

setIdleTimeout

public void setIdleTimeout(int i)
Specified by:
setIdleTimeout in interface Sender<ByteBuffer>

exceptionCaught

public void exceptionCaught(org.apache.mina.common.IoSession protocolSession,
                            Throwable throwable)
                     throws Exception
Specified by:
exceptionCaught in interface org.apache.mina.common.IoHandler
Overrides:
exceptionCaught in class org.apache.mina.common.IoHandlerAdapter
Throws:
Exception

messageReceived

public void messageReceived(org.apache.mina.common.IoSession protocolSession,
                            Object message)
                     throws Exception
Invoked when a message is received on a particular protocol session. Note that a protocol session is directly tied to a particular physical connection.

Specified by:
messageReceived in interface org.apache.mina.common.IoHandler
Overrides:
messageReceived in class org.apache.mina.common.IoHandlerAdapter
Parameters:
protocolSession - the protocol session that received the message
message - the message itself (i.e. a decoded frame)
Throws:
Exception - if the message cannot be processed

sessionClosed

public void sessionClosed(org.apache.mina.common.IoSession protocolSession)
                   throws Exception
Specified by:
sessionClosed in interface org.apache.mina.common.IoHandler
Overrides:
sessionClosed in class org.apache.mina.common.IoHandlerAdapter
Throws:
Exception

sessionCreated

public void sessionCreated(org.apache.mina.common.IoSession protocolSession)
                    throws Exception
Specified by:
sessionCreated in interface org.apache.mina.common.IoHandler
Overrides:
sessionCreated in class org.apache.mina.common.IoHandlerAdapter
Throws:
Exception

sessionIdle

public void sessionIdle(org.apache.mina.common.IoSession session,
                        org.apache.mina.common.IdleStatus status)
                 throws Exception
Specified by:
sessionIdle in interface org.apache.mina.common.IoHandler
Overrides:
sessionIdle in class org.apache.mina.common.IoHandlerAdapter
Throws:
Exception

setProtocolEngineFactory

public void setProtocolEngineFactory(ProtocolEngineFactory engineFactory,
                                     boolean acceptingConnections)

setProtocolEngine

public void setProtocolEngine(ProtocolEngine protocolEngine)


Licensed to the Apache Software Foundation