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() |
long |
getClosedConnectionCount()
Returns total number of closed connector since the creation of connector.
|
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 |
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
|
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 |
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 |
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 |
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, 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 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–2025 Devexperts LLC. All rights reserved.