@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.Joinable
MessageConnector.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, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEndpointStats, getFieldReplacer, getName, getPassword, getReconnectDelay, getThreadPriority, getUser, reconnect, resetEndpointStats, restart, setFieldReplacer, setName, setPassword, setReconnectDelay, setThreadPriority, setUser, stop
awaitProcessed
protected 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 null
public ClientSocketConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory, String address)
factory
- application connection factory to useaddress
- list of addressesNullPointerException
- if factory
or address
is null
public String getAddress()
MessageConnectorMBean
getAddress
in interface MessageConnectorMBean
public void setAddress(String address)
setAddress
in interface ClientSocketConnectorMBean
@Deprecated public String getHost()
ClientSocketConnectorMBean
getHost
in interface ClientSocketConnectorMBean
@Deprecated public void setHost(String host)
@Deprecated public int getPort()
ClientSocketConnectorMBean
getPort
in interface ClientSocketConnectorMBean
@Deprecated public void setPort(int port)
public String getProxyHost()
ClientSocketConnectorMBean
getProxyHost
in interface ClientSocketConnectorMBean
public void setProxyHost(String proxyHost)
setProxyHost
in interface ClientSocketConnectorMBean
public int getProxyPort()
ClientSocketConnectorMBean
getProxyPort
in interface ClientSocketConnectorMBean
public void setProxyPort(int proxyPort)
setProxyPort
in interface ClientSocketConnectorMBean
public ConnectOrder getConnectOrder()
getConnectOrder
in interface ClientSocketConnectorMBean
public void setConnectOrder(ConnectOrder connectOrder)
setConnectOrder
in interface ClientSocketConnectorMBean
public String getRestoreTime()
getRestoreTime
in interface ClientSocketConnectorMBean
public void setRestoreTime(String restoreTime)
setRestoreTime
in interface ClientSocketConnectorMBean
public String restoreNow()
restoreNow
in interface ClientSocketConnectorMBean
public String restoreGracefully(String gracefulDelay)
ClientSocketConnectorMBean
restoreGracefully
in interface ClientSocketConnectorMBean
public String getStripe()
ClientSocketConnectorMBean
getStripe
in interface ClientSocketConnectorMBean
public 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 MessageConnector
setStats
in class AbstractMessageConnector
IllegalStateException
- if already set.public boolean isActive()
MessageConnectorMBean
isActive
in interface MessageConnectorMBean
public MessageConnectorState getState()
MessageConnectorMBean
getState
in interface MessageConnectorMBean
public int getConnectionCount()
MessageConnectorMBean
getConnectionCount
in interface MessageConnectorMBean
public com.devexperts.transport.stats.EndpointStats retrieveCompleteEndpointStats()
MessageConnectorMBean
retrieveCompleteEndpointStats
in interface MessageConnectorMBean
retrieveCompleteEndpointStats
in class AbstractMessageConnector
public void start()
MessageConnectorMBean
start
in interface MessageConnectorMBean
start
in class AbstractMessageConnector
protected Socket createSocket(String host, int port) throws IOException
IOException
protected AbstractMessageConnector.Joinable stopImpl()
stopImpl
in class AbstractMessageConnector
protected void restartImpl(boolean fullStop)
AbstractMessageConnector
false
, connection context
(like last chosen address for multi-host connections) may be preserved.restartImpl
in class AbstractMessageConnector
public void handlerClosed(com.devexperts.qd.qtp.socket.SocketHandler handler)
handlerClosed
in interface SocketHandler.CloseListener
public String getCurrentHost()
ClientSocketConnectorMBean
getCurrentHost
in interface ClientSocketConnectorMBean
public int getCurrentPort()
getCurrentPort
in interface ClientSocketConnectorMBean
public String[] getCurrentAddresses()
ClientSocketConnectorMBean
getCurrentAddresses
in interface ClientSocketConnectorMBean
Copyright © 2002–2025 Devexperts LLC. All rights reserved.