@MessageConnectorSummary(info="Connects to some host using TCP/IP client socket.", addressFormat="<host>:<port>") public class ClientSocketConnector extends AbstractMessageConnector implements SocketHandler.CloseListener, ClientSocketConnectorMBean
ClientSocketConnector handles standard client socket using blocking API.AbstractMessageConnector.JoinableMessageConnector.Bindable| Modifier and Type | Field and Description |
|---|---|
protected String |
address |
protected LocalTime |
connectionRestoreTime |
protected ConnectOrder |
connectOrder |
protected String |
proxyHost |
protected int |
proxyPort |
protected List<SocketAddress> |
socketAddresses |
protected String |
stripeConfig |
protected SymbolStriper |
striper |
protected TrustManager |
trustManager |
protected boolean |
useTls |
log| Constructor and Description |
|---|
ClientSocketConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory,
String address)
Creates new client socket connector.
|
ClientSocketConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory,
String host,
int port)
Deprecated.
|
ClientSocketConnector(MessageAdapter.Factory factory,
String host,
int port)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
protected Socket |
createSocket(String host,
int port) |
String |
getAddress()
Address string of connector.
|
int |
getConnectionCount()
Number of established connections
|
ConnectOrder |
getConnectOrder() |
String[] |
getCurrentAddresses()
List of addresses (host:port) for all active connections
|
String |
getCurrentHost()
Current IP address of connection when connecting to the cluster
|
int |
getCurrentPort() |
String |
getHost()
Deprecated.
|
int |
getPort()
Deprecated.
|
String |
getProxyHost()
HTTP proxy host name
|
int |
getProxyPort()
HTTP proxy port
|
String |
getRestoreTime() |
MessageConnectorState |
getState()
State of connector.
|
String |
getStripe()
Symbol striper for connector, auto (for system default), or null (default)
|
boolean |
getTls()
Deprecated.
|
TrustManager |
getTrustManager()
Deprecated.
|
void |
handlerClosed(com.devexperts.qd.qtp.socket.SocketHandler handler) |
boolean |
isActive()
True when connector is active (started).
|
protected void |
restartImpl(boolean fullStop)
Restart logic implementation; If fullStop is
false, connection context
(like last chosen address for multi-host connections) may be preserved. |
String |
restoreGracefully(String gracefulDelay)
Restore connection graceful with delay in TimePeriod format
|
String |
restoreNow() |
com.devexperts.transport.stats.EndpointStats |
retrieveCompleteEndpointStats()
Retrieves endpoint statistics for this message connector since its creation
|
void |
setAddress(String address) |
void |
setConnectOrder(ConnectOrder connectOrder) |
void |
setHost(String host)
Deprecated.
|
void |
setPort(int port)
Deprecated.
|
void |
setProxyHost(String proxyHost) |
void |
setProxyPort(int proxyPort) |
void |
setRestoreTime(String restoreTime) |
void |
setStats(QDStats stats)
Sets stats for this connector.
|
void |
setStripe(String stripeConfig) |
void |
setTls(boolean useTls)
Deprecated.
|
void |
setTrustManager(TrustManager trustManager)
Deprecated.
|
void |
start()
Starts connector (connection is immediately established).
|
protected AbstractMessageConnector.Joinable |
stopImpl() |
addClosedConnectionStats, addMessageConnectorListener, close, closeImpl, getClosedConnectionCount, getEndpointStats, getFactory, getFieldReplacer, getLogging, getName, getPassword, getReconnectDelay, getStats, getThreadPriority, getUser, handlerClosed, isClosed, notifyMessageConnectorListeners, reconfigure, reconnect, removeMessageConnectorListener, resetEndpointStats, restart, setFactory, setFieldReplacer, setName, setPassword, setReconnectDelay, setThreadPriority, setUser, stop, stopAndWait, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetEndpointStats, getFieldReplacer, getName, getPassword, getReconnectDelay, getThreadPriority, getUser, reconnect, resetEndpointStats, restart, setFieldReplacer, setName, setPassword, setReconnectDelay, setThreadPriority, setUser, stopawaitProcessedprotected String address
protected List<SocketAddress> socketAddresses
protected String proxyHost
protected int proxyPort
protected ConnectOrder connectOrder
protected LocalTime connectionRestoreTime
protected SymbolStriper striper
protected String stripeConfig
protected boolean useTls
protected TrustManager trustManager
@Deprecated public ClientSocketConnector(MessageAdapter.Factory factory, String host, int port)
ClientSocketConnector(ApplicationConnectionFactory, String, int)factory - message adapter factory to usehost - host to connect toport - TCP port to connect toNullPointerException - if factory or host is null@Deprecated public ClientSocketConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory, String host, int port)
factory - application connection factory to usehost - host to connect toport - TCP port to connect toNullPointerException - if factory or host is nullpublic ClientSocketConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory,
String address)
factory - application connection factory to useaddress - list of addressesNullPointerException - if factory or address is nullpublic String getAddress()
MessageConnectorMBeangetAddress in interface MessageConnectorMBeanpublic void setAddress(String address)
setAddress in interface ClientSocketConnectorMBean@Deprecated public String getHost()
ClientSocketConnectorMBeangetHost in interface ClientSocketConnectorMBean@Deprecated public void setHost(String host)
@Deprecated public int getPort()
ClientSocketConnectorMBeangetPort in interface ClientSocketConnectorMBean@Deprecated public void setPort(int port)
public String getProxyHost()
ClientSocketConnectorMBeangetProxyHost in interface ClientSocketConnectorMBeanpublic void setProxyHost(String proxyHost)
setProxyHost in interface ClientSocketConnectorMBeanpublic int getProxyPort()
ClientSocketConnectorMBeangetProxyPort in interface ClientSocketConnectorMBeanpublic void setProxyPort(int proxyPort)
setProxyPort in interface ClientSocketConnectorMBeanpublic ConnectOrder getConnectOrder()
getConnectOrder in interface ClientSocketConnectorMBeanpublic void setConnectOrder(ConnectOrder connectOrder)
setConnectOrder in interface ClientSocketConnectorMBeanpublic String getRestoreTime()
getRestoreTime in interface ClientSocketConnectorMBeanpublic void setRestoreTime(String restoreTime)
setRestoreTime in interface ClientSocketConnectorMBeanpublic String restoreNow()
restoreNow in interface ClientSocketConnectorMBeanpublic String restoreGracefully(String gracefulDelay)
ClientSocketConnectorMBeanrestoreGracefully in interface ClientSocketConnectorMBeanpublic String getStripe()
ClientSocketConnectorMBeangetStripe in interface ClientSocketConnectorMBeanpublic void setStripe(String stripeConfig)
setStripe in interface ClientSocketConnectorMBean@Deprecated public boolean getTls()
@Deprecated public void setTls(boolean useTls)
@Deprecated public TrustManager getTrustManager()
@Deprecated public void setTrustManager(TrustManager trustManager)
trust manager to be used by SSLSocketFactory.
This property has effect only when the connector is configured to use TLS.trustManager - trust manager to use instead of the default one, or null in order to use default one.public void setStats(QDStats stats)
QDStats.SType#CLIENT_SOCKET_CONNECTOR or
a suitable substitute. This method may be invoked only once.setStats in interface MessageConnectorsetStats in class AbstractMessageConnectorIllegalStateException - if already set.public boolean isActive()
MessageConnectorMBeanisActive in interface MessageConnectorMBeanpublic MessageConnectorState getState()
MessageConnectorMBeangetState in interface MessageConnectorMBeanpublic int getConnectionCount()
MessageConnectorMBeangetConnectionCount in interface MessageConnectorMBeanpublic com.devexperts.transport.stats.EndpointStats retrieveCompleteEndpointStats()
MessageConnectorMBeanretrieveCompleteEndpointStats in interface MessageConnectorMBeanretrieveCompleteEndpointStats in class AbstractMessageConnectorpublic void start()
MessageConnectorMBeanstart in interface MessageConnectorMBeanstart in class AbstractMessageConnectorprotected Socket createSocket(String host, int port) throws IOException
IOExceptionprotected AbstractMessageConnector.Joinable stopImpl()
stopImpl in class AbstractMessageConnectorprotected void restartImpl(boolean fullStop)
AbstractMessageConnectorfalse, connection context
(like last chosen address for multi-host connections) may be preserved.restartImpl in class AbstractMessageConnectorpublic void handlerClosed(com.devexperts.qd.qtp.socket.SocketHandler handler)
handlerClosed in interface SocketHandler.CloseListenerpublic String getCurrentHost()
ClientSocketConnectorMBeangetCurrentHost in interface ClientSocketConnectorMBeanpublic int getCurrentPort()
getCurrentPort in interface ClientSocketConnectorMBeanpublic String[] getCurrentAddresses()
ClientSocketConnectorMBeangetCurrentAddresses in interface ClientSocketConnectorMBeanCopyright © 2002–2025 Devexperts LLC. All rights reserved.