public class TcpConnector extends AbstractConnector
TcpConnector
can bind or sent to a given TCP port on a given host.
Other socket-based transports can be built on top of this class by providing the
appropriate socket factories and application level protocols as required (see
the constructor and the SSL transport for examples).Modifier and Type | Field and Description |
---|---|
static boolean |
CLIENT |
static int |
DEFAULT_BACKLOG |
static int |
DEFAULT_BUFFER_SIZE |
static int |
DEFAULT_SO_LINGER |
static int |
DEFAULT_SOCKET_TIMEOUT |
static String |
KEEP_SEND_SOCKET_OPEN_PROPERTY
Property can be set on the endpoint to configure how the socket is managed
|
static boolean |
SERVER |
static String |
TCP |
connected, connectedSemaphore, connecting, connectionStrategy, createMultipleTransactedReceivers, DEFAULT_NUM_CONCURRENT_TX_RECEIVERS, dispatcherFactory, dispatchers, disposed, disposing, exceptionListener, initialised, logger, muleContext, name, numberOfConcurrentTransactedReceivers, receivers, requesterFactory, requesters, serviceDescriptor, serviceOverrides, sessionHandler, started, startOnConnect
INT_VALUE_NOT_SET
PHASE_NAME
PHASE_NAME
PHASE_NAME
PHASE_NAME
Constructor and Description |
---|
TcpConnector() |
Modifier and Type | Method and Description |
---|---|
void |
configureSocket(boolean client,
Socket socket) |
protected void |
doConnect()
Template method where any connections should be made for the connector
|
protected void |
doDisconnect()
Template method where any connected resources used by the connector should be
disconnected
|
protected void |
doDispose()
Template method to perform any work when destroying the connectoe
|
protected void |
doInitialise() |
protected void |
doStart()
Template method to perform any work when starting the connectoe
|
protected void |
doStop()
Template method to perform any work when stopping the connectoe
|
int |
getBacklog()
Deprecated.
should use
getReceiveBacklog() |
int |
getBufferSize()
Deprecated.
Should use
getSendBufferSize() or getReceiveBufferSize() |
int |
getClientSoTimeout() |
ExpiryMonitor |
getKeepAliveMonitor() |
int |
getKeepAliveTimeout() |
OutputStream |
getOutputStream(ImmutableEndpoint endpoint,
MuleMessage message) |
String |
getProtocol() |
int |
getReceiveBacklog() |
int |
getReceiveBufferSize() |
int |
getSendBufferSize() |
protected ServerSocket |
getServerSocket(URI uri) |
SimpleServerSocketFactory |
getServerSocketFactory() |
int |
getServerSoTimeout() |
protected Socket |
getSocket(ImmutableEndpoint endpoint)
Lookup a socket in the list of dispatcher sockets but don't create a new
socket
|
protected AbstractTcpSocketFactory |
getSocketFactory() |
int |
getSocketSoLinger() |
TcpProtocol |
getTcpProtocol() |
boolean |
isKeepAlive() |
boolean |
isKeepSendSocketOpen() |
boolean |
isRemoteSyncEnabled() |
Boolean |
isReuseAddress() |
boolean |
isSendTcpNoDelay() |
boolean |
isValidateConnections()
Should the connection be checked before sending data?
|
void |
setBacklog(int backlog)
Deprecated.
should use
setReceiveBacklog(int) |
void |
setBufferSize(int bufferSize)
Deprecated.
Should use
setSendBufferSize(int) or setReceiveBufferSize(int) |
void |
setClientSoTimeout(int timeout) |
void |
setKeepAlive(boolean keepAlive) |
void |
setKeepAliveTimeout(int keepAliveTimeout)
Sets the keep alive timeout (in Milliseconds)
|
void |
setKeepSendSocketOpen(boolean keepSendSocketOpen) |
void |
setReceiveBacklog(int receiveBacklog) |
void |
setReceiveBufferSize(int bufferSize) |
void |
setReuseAddress(Boolean reuseAddress)
This allows closed sockets to be reused while they are still in TIME_WAIT state
|
void |
setSendBufferSize(int bufferSize) |
void |
setSendTcpNoDelay(boolean sendTcpNoDelay) |
void |
setServerSocketFactory(SimpleServerSocketFactory serverSocketFactory) |
void |
setServerSoTimeout(int timeout) |
protected void |
setSocketFactory(AbstractTcpSocketFactory socketFactory) |
void |
setSocketSoLinger(int soLinger) |
void |
setTcpProtocol(TcpProtocol tcpProtocol) |
void |
setTimeout(int timeout)
Deprecated.
The time out should be set explicitly for each
|
void |
setValidateConnections(boolean validateConnections) |
checkDisposed, connect, createReceiver, destroyReceiver, disconnect, dispatch, dispose, disposeDispatchers, disposeReceivers, disposeRequesters, disposeWorkManagers, exceptionThrown, fireNotification, getConnectedSemaphore, getConnectEventId, getConnectionDescription, getConnectionStrategy, getDefaultInboundTransformers, getDefaultOutboundTransformers, getDefaultResponseTransformers, getDispatcherFactory, getDispatcherThreadingProfile, getDispatcherWorkManager, getExceptionListener, getMaxDispatchersActive, getMaxRequestersActive, getMessageAdapter, getMuleContext, getName, getNumberOfConcurrentTransactedReceivers, getOutputStream, getReceiver, getReceiverKey, getReceivers, getReceivers, getReceiverThreadingProfile, getReceiverWorkManager, getReplyToHandler, getRequesterFactory, getRequesterThreadingProfile, getRequesterWorkManager, getScheduler, getServiceDescriptor, getServiceOverrides, getSessionHandler, getSupportedProtocols, handleException, handleWorkException, initFromServiceDescriptor, initialise, initialiseFromUrl, initWorkManagers, isConnected, isCreateMultipleTransactedReceivers, isDisposed, isDisposing, isEnableMessageEvents, isStarted, isSyncEnabled, lookupReceiver, registerListener, registerSupportedProtocol, registerSupportedProtocolWithoutPrefix, request, request, send, setConnectionStrategy, setCreateMultipleTransactedReceivers, setDispatcherFactory, setDispatcherThreadingProfile, setDynamicNotification, setExceptionListener, setMaxDispatchersActive, setMaxRequestersActive, setMuleContext, setName, setNumberOfConcurrentTransactedReceivers, setReceiverThreadingProfile, setRequesterFactory, setRequesterThreadingProfile, setServiceOverrides, setSessionHandler, setSupportedProtocols, setupDispatchReturn, setupRequestReturn, start, stop, supportsProtocol, toString, unregisterListener, unregisterSupportedProtocol, updateCachedNotificationHandler, workAccepted, workCompleted, workRejected, workStarted
public static final String TCP
public static final String KEEP_SEND_SOCKET_OPEN_PROPERTY
public static final int DEFAULT_SOCKET_TIMEOUT
public static final int DEFAULT_SO_LINGER
public static final int DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BACKLOG
public static final boolean SERVER
public static final boolean CLIENT
public void configureSocket(boolean client, Socket socket) throws SocketException
SocketException
protected void doInitialise() throws InitialisationException
doInitialise
in class AbstractConnector
InitialisationException
protected void doDispose()
AbstractConnector
doDispose
in class AbstractConnector
protected Socket getSocket(ImmutableEndpoint endpoint) throws Exception
Exception
public OutputStream getOutputStream(ImmutableEndpoint endpoint, MuleMessage message) throws MuleException
MuleException
protected void doConnect() throws Exception
AbstractConnector
doConnect
in class AbstractConnector
Exception
protected void doDisconnect() throws Exception
AbstractConnector
doDisconnect
in class AbstractConnector
Exception
protected void doStart() throws MuleException
AbstractConnector
doStart
in class AbstractConnector
MuleException
- if the method failsprotected void doStop() throws MuleException
AbstractConnector
doStop
in class AbstractConnector
MuleException
- if the method failspublic String getProtocol()
public boolean isKeepSendSocketOpen()
public void setKeepSendSocketOpen(boolean keepSendSocketOpen)
public void setTimeout(int timeout)
public int getClientSoTimeout()
public void setClientSoTimeout(int timeout)
public int getServerSoTimeout()
public void setServerSoTimeout(int timeout)
public int getBufferSize()
public void setBufferSize(int bufferSize)
public int getSendBufferSize()
public void setSendBufferSize(int bufferSize)
public int getReceiveBufferSize()
public void setReceiveBufferSize(int bufferSize)
public int getReceiveBacklog()
public void setReceiveBacklog(int receiveBacklog)
public int getSocketSoLinger()
public void setSocketSoLinger(int soLinger)
public int getBacklog()
getReceiveBacklog()
public void setBacklog(int backlog)
setReceiveBacklog(int)
backlog
- public TcpProtocol getTcpProtocol()
public void setTcpProtocol(TcpProtocol tcpProtocol)
public boolean isRemoteSyncEnabled()
isRemoteSyncEnabled
in interface Connector
isRemoteSyncEnabled
in class AbstractConnector
public boolean isKeepAlive()
public void setKeepAlive(boolean keepAlive)
public boolean isSendTcpNoDelay()
public void setSendTcpNoDelay(boolean sendTcpNoDelay)
protected void setSocketFactory(AbstractTcpSocketFactory socketFactory)
protected AbstractTcpSocketFactory getSocketFactory()
public SimpleServerSocketFactory getServerSocketFactory()
public void setServerSocketFactory(SimpleServerSocketFactory serverSocketFactory)
protected ServerSocket getServerSocket(URI uri) throws IOException
IOException
public boolean isValidateConnections()
public void setValidateConnections(boolean validateConnections)
validateConnections
- If true, the message adapter opens and closes the socket on intialisation.isValidateConnections()
public Boolean isReuseAddress()
public void setReuseAddress(Boolean reuseAddress)
reuseAddress
- Whether the server socket sets SO_REUSEADDRESS before openingpublic ExpiryMonitor getKeepAliveMonitor()
public int getKeepAliveTimeout()
public void setKeepAliveTimeout(int keepAliveTimeout)
Copyright © 2003–2013 MuleSource, Inc.. All rights reserved.