Skip to content

Commit 2609035

Browse files
feat: add start method to JMX Connector operations
A `start()` method was added to the JMX `Connector` operations, enabling users to start the Acceptor/Initiator after stopping it. The implementation follows coding standards and was positioned consistently with the interface. No errors were encountered with the new functionality.
1 parent ba758d1 commit 2609035

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

quickfixj-core/src/main/java/org/quickfixj/jmx/mbean/connector/ConnectorAdmin.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
import org.slf4j.Logger;
2626
import org.slf4j.LoggerFactory;
2727
import quickfix.Acceptor;
28+
import quickfix.ConfigError;
2829
import quickfix.Connector;
2930
import quickfix.Initiator;
31+
import quickfix.RuntimeError;
3032
import quickfix.Session;
3133
import quickfix.SessionID;
3234
import quickfix.SessionSettings;
@@ -142,6 +144,15 @@ private ObjectName[] toObjectNameArray(List<ObjectName> sessions) {
142144
return sessions.toArray(new ObjectName[sessions.size()]);
143145
}
144146

147+
public void start() throws IOException {
148+
log.info("JMX operation: start {} {}", getRole(), this);
149+
try {
150+
connector.start();
151+
} catch (ConfigError | RuntimeError e) {
152+
throw JmxSupport.toIOException(e);
153+
}
154+
}
155+
145156
public void stop(boolean force) {
146157
log.info("JMX operation: stop {} {}", getRole(), this);
147158
connector.stop(force);

quickfixj-core/src/main/java/org/quickfixj/jmx/mbean/connector/ConnectorAdminMBean.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ public interface ConnectorAdminMBean {
3030
*/
3131
String getRole() throws IOException;
3232

33+
/**
34+
* Start the connector.
35+
*
36+
* @throws IOException if there is a problem starting the connector
37+
*/
38+
void start() throws IOException;
39+
3340
/**
3441
* Stop the connector.
3542
*

0 commit comments

Comments
 (0)