public final class TcpListenerConnection extends AbstractSocketConnection implements ListenerConnection
ListenerConnection for receiving TCP connections.| Modifier and Type | Field and Description |
|---|---|
protected TcpProtocol |
protocol
|
connectionSettings, LOGGER, wasDisconnected| Constructor and Description |
|---|
TcpListenerConnection(SocketConnectionSettings connectionSettings,
TcpProtocol protocol,
TcpServerSocketProperties socketProperties,
SimpleServerSocketFactory serverSocketFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Configures the
ServerSocket instance with the TcpServerSocketProperties parameters. |
void |
doDisconnect()
Template method that does the concrete disconnection for the socket
|
protected InetSocketAddress |
getSocketAddress(SocketConnectionSettings connectionSettings,
boolean failOnUnresolvedHost)
Creates an
InetSocketAddress with the host and port information. |
void |
initialise()
Injection of the
ObjectSerializer is needed for TcpProtocol |
SocketWorker |
listen(org.mule.runtime.extension.api.runtime.source.SourceCallback<InputStream,SocketAttributes> callback)
One worker is created per accepted connection.
|
org.mule.runtime.api.connection.ConnectionValidationResult |
validate()
Validates socket's connection
|
disconnectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdisconnectprotected final TcpProtocol protocol
public TcpListenerConnection(SocketConnectionSettings connectionSettings, TcpProtocol protocol, TcpServerSocketProperties socketProperties, SimpleServerSocketFactory serverSocketFactory) throws org.mule.runtime.api.connection.ConnectionException
org.mule.runtime.api.connection.ConnectionExceptionpublic SocketWorker listen(org.mule.runtime.extension.api.runtime.source.SourceCallback<InputStream,SocketAttributes> callback) throws IOException, org.mule.runtime.api.connection.ConnectionException
The new Socket used for responding has the same TcpSocketProperties settings as the listener socket used in
the Source.
listen in interface ListenerConnectioncallback - used in the SocketWorker to deliver the new received messagesRunnable that will represent a new received connection. The Runnable should be scheduled with an
Executor in it's own thread.org.mule.runtime.api.connection.ConnectionException - if the socket was close while blocked on DatagramSocket.receive(DatagramPacket) method
and the close was not intentionally done by the AbstractSocketConnection.disconnect() method.IOException - if the socket was close while blocked on DatagramSocket.receive(DatagramPacket) method.public void doDisconnect()
AbstractSocketConnectiondoDisconnect in class AbstractSocketConnectionpublic void connect()
throws org.mule.runtime.api.connection.ConnectionException
ServerSocket instance with the TcpServerSocketProperties parameters. It does not invoke
ServerSocket.accept() because that would block the method causing an incompatible behaviour with the Source
that uses this connection.connect in interface SocketConnectionorg.mule.runtime.api.connection.ConnectionException - if the connection couldn't be establishedpublic org.mule.runtime.api.connection.ConnectionValidationResult validate()
validate in interface SocketConnectionpublic void initialise()
throws org.mule.runtime.api.lifecycle.InitialisationException
ObjectSerializer is needed for TcpProtocolinitialise in interface org.mule.runtime.api.lifecycle.Initialisableorg.mule.runtime.api.lifecycle.InitialisationExceptionprotected InetSocketAddress getSocketAddress(SocketConnectionSettings connectionSettings, boolean failOnUnresolvedHost) throws org.mule.runtime.api.connection.ConnectionException
InetSocketAddress with the host and port information.failOnUnresolvedHost - whether a UnresolvableHostException should be thrown if the address couldn't be resolved.InetSocketAddress configured with the host and port receivedorg.mule.runtime.api.connection.ConnectionExceptionCopyright © 2003–2016 MuleSoft, Inc.. All rights reserved.