public abstract class AbstractMessageConnector extends Object implements MessageConnector
| Modifier and Type | Class and Description |
|---|---|
static interface |
AbstractMessageConnector.Joinable |
MessageConnector.Bindable| Modifier and Type | Field and Description |
|---|---|
protected com.devexperts.logging.Logging |
log |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractMessageConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory)
Constructs new abstract message connector.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addClosedConnectionStats(com.devexperts.transport.stats.ConnectionStats stats) |
void |
addMessageConnectorListener(MessageConnectorListener listener)
Adds the specified
listener to this message connector. |
void |
close()
Permanently closes connector and releases its resources.
|
protected void |
closeImpl() |
com.devexperts.util.TimePeriodInfo |
getAggregationPeriodInfo()
Returns the aggregation period info aggregated across all active adapters on this connector.
|
String |
getAggregationPeriodInfoStr()
Returns the current effective aggregation period info as JSON across all active connections.
|
long |
getClosedConnectionCount()
Returns total number of closed connector since the creation of connector.
|
String |
getDefaultAggregationPeriod()
Returns the default aggregation period for server-side connections, or
null if not set. |
String |
getEndpointStats()
Endpoint statistics since last reset
|
com.devexperts.connector.proto.ApplicationConnectionFactory |
getFactory()
Returns
ApplicationConnectionFactory that is used by this message connector. |
String |
getFieldReplacer()
Returns configured input field replacers.
|
com.devexperts.logging.Logging |
getLogging()
Returns
Logging instance that is tied to this MessageConnector and
includes this connector's name into the logs. |
String |
getMaxAggregationPeriod()
Returns the maximum aggregation period bound for server-side connections, or
null if not set. |
protected List<MessageAdapter> |
getMessageAdapters()
Returns a snapshot list of all active message adapters.
|
String |
getMinAggregationPeriod()
Returns the minimum aggregation period bound for server-side connections, or
null if not set. |
String |
getName()
Returns short string description of this connector for management and logging purposes.
|
String |
getPassword()
User password for authorization.
|
long |
getReconnectDelay()
Delay between reconnection attempts in milliseconds
|
String |
getRequestedAggregationPeriod()
Returns the client-requested aggregation period string.
|
QDStats |
getStats()
Returns
QDStats associated with this message connector. |
int |
getThreadPriority()
Priority for threads associated with this connector
|
String |
getUser()
User login name
Returns connector's user name for authorization.
|
protected void |
handlerClosed(AbstractConnectionHandler handler)
Invoked by handler to notify about associated connector about handler's death.
|
protected boolean |
isClosed() |
void |
notifyMessageConnectorListeners() |
protected void |
reconfigure() |
void |
reconnect()
Reconnects connector.
|
void |
removeMessageConnectorListener(MessageConnectorListener listener)
Removes the specified
listener from this message connector. |
void |
resetEndpointStats()
Resets endpoint statistics
|
void |
restart()
Restarts connector (connection is immediately dropped and established again).
|
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. |
com.devexperts.transport.stats.EndpointStats |
retrieveCompleteEndpointStats()
Retrieves endpoint statistics for this message connector since its creation
|
void |
setAggregationPeriod(String period)
Alias for
setDefaultAggregationPeriod(java.lang.String) to support address format aggregationPeriod=1s. |
void |
setDefaultAggregationPeriod(String defaultAggregationPeriod)
Sets the default aggregation period applied when client doesn't specify one.
|
void |
setFactory(com.devexperts.connector.proto.ApplicationConnectionFactory factory)
Changes
ApplicationConnectionFactory that is used by this message connector. |
void |
setFieldReplacer(String fieldReplacer)
Sets input field replacers.
|
void |
setMaxAggregationPeriod(String maxAggregationPeriod)
Sets the maximum bound for aggregation period validation.
|
void |
setMinAggregationPeriod(String minAggregationPeriod)
Sets the minimum bound for aggregation period validation.
|
void |
setName(String name)
Overrides name of this connector for management and logging purposes.
|
void |
setPassword(String password)
Sets password for authorization.
|
void |
setReconnectDelay(long reconnectDelay)
Sets reconnection delay.
|
void |
setRequestedAggregationPeriod(String requestedAggregationPeriod)
Sets the requested aggregation period to send to the server via DESCRIBE_PROTOCOL.
|
void |
setStats(QDStats stats)
Changes
QDStats associated with this message connector. |
void |
setThreadPriority(int priority)
Sets thread priority for all threads created by this connector.
|
void |
setUser(String user)
Sets connector's user name for authorization.
|
abstract void |
start()
Starts connector (connection is immediately established).
|
void |
stop()
Stops connector (connection is immediately dropped).
|
void |
stopAndWait()
Stops connector and waits while all its threads are terminated.
|
protected abstract AbstractMessageConnector.Joinable |
stopImpl() |
String |
toString()
Returns name of this connector.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitawaitProcessedgetAddress, getAggregationPeriod, getConnectionCount, getState, isActiveprotected AbstractMessageConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory)
factory - application connection factory to useNullPointerException - if factory is nullpublic String toString()
public String getName()
name
of the corresponding ApplicationConnectionFactory.
This description may be manually overridden to arbitrary value via setName(java.lang.String) method.getName in interface MessageConnectorMBeansetName(String)public void setName(String name)
name
of the corresponding ApplicationConnectionFactory.setName in interface MessageConnectorMBeanname - connector name to set; it may be null in which case default
autogenerated name will be used.getName()public String getUser()
MessageConnectorMBeangetUser in interface MessageConnectorMBeanpublic void setUser(String user)
MessageConnectorMBeansetUser in interface MessageConnectorMBeanuser - connector's user name for authorization.public String getPassword()
MessageConnectorMBeangetPassword in interface MessageConnectorMBeanpublic void setPassword(String password)
MessageConnectorMBeansetPassword in interface MessageConnectorMBeanpassword - password for authorization.public com.devexperts.connector.proto.ApplicationConnectionFactory getFactory()
MessageConnectorApplicationConnectionFactory that is used by this message connector.getFactory in interface MessageConnectorApplicationConnectionFactory that is used by this message connector.public void setFactory(com.devexperts.connector.proto.ApplicationConnectionFactory factory)
MessageConnectorApplicationConnectionFactory that is used by this message connector.setFactory in interface MessageConnectorfactory - ApplicationConnectionFactory that will be used by this message connector.public long getReconnectDelay()
MessageConnectorMBeangetReconnectDelay in interface MessageConnectorMBeanpublic void setReconnectDelay(long reconnectDelay)
MessageConnectorMBeansetReconnectDelay in interface MessageConnectorMBeanreconnectDelay - reconnection delaypublic String getFieldReplacer()
MessageConnectorMBeangetFieldReplacer in interface MessageConnectorMBeanpublic void setFieldReplacer(String fieldReplacer)
MessageConnectorMBeansetFieldReplacer in interface MessageConnectorMBeanfieldReplacer - field replacers specification.public QDStats getStats()
MessageConnectorQDStats associated with this message connector.getStats in interface MessageConnectorpublic void setStats(QDStats stats)
MessageConnectorQDStats associated with this message connector.setStats in interface MessageConnectorpublic abstract void start()
MessageConnectorMBeanstart in interface MessageConnectorMBeanprotected abstract AbstractMessageConnector.Joinable stopImpl()
protected void handlerClosed(AbstractConnectionHandler handler)
Recommended implementation template:
- check if handler is still actual (beware of asynchronous execution) and cut-out local handler reference
- restart processing (if needed)
handler - - the notifying handlerpublic final void stop()
MessageConnectorMBeanstop in interface MessageConnectorMBeanpublic final void stopAndWait()
throws InterruptedException
MessageConnectorstopAndWait in interface MessageConnectorInterruptedException - if interrupted.public void restart()
MessageConnectorMBeanMessageConnectorMBean.stop() and MessageConnectorMBean.start() in sequence.restart in interface MessageConnectorMBeanpublic void reconnect()
MessageConnectorMBeanMessageConnectorMBean.restart() method, reconnect should try to follow specified
reconnection policy (like choosing next node in cluster) if applicable.
Default behavior is just performing MessageConnectorMBean.restart().
reconnect in interface MessageConnectorMBeanprotected void restartImpl(boolean fullStop)
false, connection context
(like last chosen address for multi-host connections) may be preserved.fullStop - protected void reconfigure()
public int getThreadPriority()
MessageConnectorMBeangetThreadPriority in interface MessageConnectorMBeanpublic void setThreadPriority(int priority)
MessageConnectorMBeansetThreadPriority in interface MessageConnectorMBeanpriority - thread priority for all threads created by this connectorpublic String getEndpointStats()
MessageConnectorMBeangetEndpointStats in interface MessageConnectorMBeanMessageConnectorMBean.resetEndpointStats().public void resetEndpointStats()
MessageConnectorMBeanresetEndpointStats in interface MessageConnectorMBeanpublic com.devexperts.transport.stats.EndpointStats retrieveCompleteEndpointStats()
MessageConnectorMBeanretrieveCompleteEndpointStats in interface MessageConnectorMBeanpublic long getClosedConnectionCount()
MessageConnectorgetClosedConnectionCount in interface MessageConnectorpublic void addClosedConnectionStats(com.devexperts.transport.stats.ConnectionStats stats)
public String getRequestedAggregationPeriod()
MessageConnectorMBeannull if not set.
Applicable for client-side connectors (propagated to all DistributorAdapters).getRequestedAggregationPeriod in interface MessageConnectorMBeanpublic void setRequestedAggregationPeriod(String requestedAggregationPeriod)
MessageConnectorMBeansetRequestedAggregationPeriod in interface MessageConnectorMBeanrequestedAggregationPeriod - aggregation period string (e.g. "1s", "0.5s"),
or "undefined"/null/empty to reset (server uses its default)public com.devexperts.util.TimePeriodInfo getAggregationPeriodInfo()
MessageConnectorTimePeriodInfo.UNKNOWN if no adapter has aggregation period info available.getAggregationPeriodInfo in interface MessageConnectorpublic String getAggregationPeriodInfoStr()
MessageConnectorMBean{"min":1.5,"max":2.0} (seconds with decimals),
or {"min":-1,"max":-1} if not available.getAggregationPeriodInfoStr in interface MessageConnectorMBeanpublic String getDefaultAggregationPeriod()
MessageConnectorMBeannull if not set.
Alias: MessageConnectorMBean.getAggregationPeriod().getDefaultAggregationPeriod in interface MessageConnectorMBeanpublic void setDefaultAggregationPeriod(String defaultAggregationPeriod)
MessageConnectorMBeansetDefaultAggregationPeriod in interface MessageConnectorMBeandefaultAggregationPeriod - default aggregation period string (e.g. "1s"), or null to resetpublic void setAggregationPeriod(String period)
setDefaultAggregationPeriod(java.lang.String) to support address format aggregationPeriod=1s.public String getMinAggregationPeriod()
MessageConnectorMBeannull if not set.getMinAggregationPeriod in interface MessageConnectorMBeanpublic void setMinAggregationPeriod(String minAggregationPeriod)
MessageConnectorMBeansetMinAggregationPeriod in interface MessageConnectorMBeanminAggregationPeriod - minimum aggregation period string (e.g. "0.5s"), or null to resetpublic String getMaxAggregationPeriod()
MessageConnectorMBeannull if not set.getMaxAggregationPeriod in interface MessageConnectorMBeanpublic void setMaxAggregationPeriod(String maxAggregationPeriod)
MessageConnectorMBeansetMaxAggregationPeriod in interface MessageConnectorMBeanmaxAggregationPeriod - maximum aggregation period string (e.g. "5s"), or null to reset@Internal protected List<MessageAdapter> getMessageAdapters()
public final void close()
MessageConnectorclose in interface MessageConnectorprotected void closeImpl()
protected boolean isClosed()
public void addMessageConnectorListener(MessageConnectorListener listener)
MessageConnectorlistener to this message connector.addMessageConnectorListener in interface MessageConnectorlistener - newly adding MessageConnectorListener.public void removeMessageConnectorListener(MessageConnectorListener listener)
MessageConnectorlistener from this message connector.removeMessageConnectorListener in interface MessageConnectorlistener - removing MessageConnectorListener.public void notifyMessageConnectorListeners()
public com.devexperts.logging.Logging getLogging()
Logging instance that is tied to this MessageConnector and
includes this connector's name into the logs.Copyright © 2002–2026 Devexperts LLC. All rights reserved.