org.apache.qpid.proton.driver
Interface Driver


public interface Driver

The Driver interface provides an abstraction for an implementation of a driver for the proton engine. A driver is responsible for providing input, output, and tick events, to the bottom half of the engine API. TODO See ::pn_input, ::pn_output, and ::pn_tick. The driver also provides an interface for the application to access, the top half of the API when the state of the engine may have changed due to I/O or timing events. Additionally the driver incorporates the SASL engine as well in order to provide a complete network stack: AMQP over SASL over TCP.


Method Summary
 Connector connector()
          Get the next active connector in the driver.
 Iterable<Connector> connectors()
          Return an iterator over all connectors.
<C> Connector<C>
createConnector(SelectableChannel fd, C context)
          Create a connector using the existing file descriptor.
<C> Connector<C>
createConnector(String host, int port, C context)
          Construct a connector to the given remote address.
<C> Listener<C>
createListener(ServerSocketChannel c, C context)
          Create a listener using the existing channel.
<C> Listener<C>
createListener(String host, int port, C context)
          Construct a listener for the given address.
 void destroy()
          Destruct the driver and all associated listeners, connectors and other resources.
 void doWait(long timeout)
          Wait for an active connector or listener
 Listener listener()
          Get the next listener with pending data in the driver.
 Iterable<Listener> listeners()
          Return an iterator over all listeners.
 void wakeup()
          Force wait() to return
 

Method Detail

wakeup

void wakeup()
Force wait() to return


doWait

void doWait(long timeout)
Wait for an active connector or listener

Parameters:
timeout - maximum time in milliseconds to wait. 0 means infinite wait

listener

Listener listener()
Get the next listener with pending data in the driver.

Returns:
NULL if no active listener available

connector

Connector connector()
Get the next active connector in the driver. Returns the next connector with pending inbound data, available capacity for outbound data, or pending tick.

Returns:
NULL if no active connector available

destroy

void destroy()
Destruct the driver and all associated listeners, connectors and other resources.


createListener

<C> Listener<C> createListener(String host,
                               int port,
                               C context)
Construct a listener for the given address.

Parameters:
host - local host address to listen on
port - local port to listen on
context - application-supplied, can be accessed via getContext() method on a listener.
Returns:
a new listener on the given host:port, NULL if error

createListener

<C> Listener<C> createListener(ServerSocketChannel c,
                               C context)
Create a listener using the existing channel.

Parameters:
c - existing SocketChannel for listener to listen on
context - application-supplied, can be accessed via getContext() method on a listener.
Returns:
a new listener on the given channel, NULL if error

createConnector

<C> Connector<C> createConnector(String host,
                                 int port,
                                 C context)
Construct a connector to the given remote address.

Parameters:
host - remote host to connect to.
port - remote port to connect to.
context - application-supplied, can be accessed via getContext() method on a listener.
Returns:
a new connector to the given remote, or NULL on error.

createConnector

<C> Connector<C> createConnector(SelectableChannel fd,
                                 C context)
Create a connector using the existing file descriptor.

Parameters:
fd - existing SocketChannel for listener to listen on
context - application-supplied, can be accessed via getContext() method on a listener.
Returns:
a new connector to the given host:port, NULL if error.

listeners

Iterable<Listener> listeners()
Return an iterator over all listeners.


connectors

Iterable<Connector> connectors()
Return an iterator over all connectors.



Copyright © 2013 The Apache Software Foundation. All Rights Reserved.