public interface Driver
Connector
's and Listener
's, which act as intermediaries between
the proton engine and the network.
Provides methods for the application to access the "top half" of the engine API when the state
of the engine may have changed due to I/O or timing events - see connector()
.
Connectors incorporate the SASL engine in order to provide a complete network stack:
AMQP over SASL over TCP.
Unless otherwise stated, methods on Driver implementations are not necessarily thread-safe.Modifier and Type | Interface and Description |
---|---|
static class |
Driver.Factory |
Modifier and Type | Method and Description |
---|---|
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.
|
boolean |
doWait(long timeout)
Wait for an active connector or listener, or for
wakeup() to be called. |
Listener |
listener()
Get the next listener with pending data in the driver.
|
Iterable<Listener> |
listeners()
Return an iterator over all listeners.
|
void |
wakeup()
Force
doWait(long) to return. |
void wakeup()
doWait(long)
to return.
If the driver is not currently waiting then the next invocation of doWait(long)
will return immediately unless the connector()
method is invoked in the meantime.
Thread-safe.boolean doWait(long timeout)
wakeup()
to be called.
Thread-safe.timeout
- maximum time in milliseconds to wait. -1 means wait indefinitely.Listener listener()
Connector connector()
wakeup()
.void destroy()
<C> Listener<C> createListener(String host, int port, C context)
host
- local host address to listen onport
- local port to listen oncontext
- application-supplied, can be accessed via
getContext()
method on a listener.<C> Listener<C> createListener(ServerSocketChannel c, C context)
c
- existing SocketChannel for listener to listen oncontext
- application-supplied, can be accessed via
getContext()
method on a listener.<C> Connector<C> createConnector(String host, int port, C context)
host
- remote host to connect to.port
- remote port to connect to.context
- application-supplied, can be accessed via
getContext()
method on a listener.<C> Connector<C> createConnector(SelectableChannel fd, C context)
fd
- existing SocketChannel for listener to listen oncontext
- application-supplied, can be accessed via
getContext()
method on a listener.Copyright © 2016 The Apache Software Foundation. All rights reserved.