Skip to content

Commit 6bee034

Browse files
authored
Merge branch 'master' into jetbrains-junie-issue-1078-run-1befc922-ca79-4788-988c-f5ac0dfe5052
2 parents 5030003 + 031152a commit 6bee034

20 files changed

Lines changed: 1479 additions & 79 deletions

File tree

.github/workflows/nightly-build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
cache: maven
2323

2424
- name: Build SNAPSHOT
25-
run: ./mvnw clean package -B -V -D"maven.javadoc.skip"="true" -D"java.util.logging.config.file"="${{github.workspace}}/quickfixj-core/src/test/resources/logging.properties" -D"http.keepAlive"="false" -D"maven.wagon.http.pool"="false" -D"maven.wagon.httpconnectionManager.ttlSeconds"="120"
25+
run: ./mvnw clean package -pl '!quickfixj-distribution' -B -V -D"maven.javadoc.skip"="true" -D"java.util.logging.config.file"="${{github.workspace}}/quickfixj-core/src/test/resources/logging.properties" -D"http.keepAlive"="false" -D"maven.wagon.http.pool"="false" -D"maven.wagon.httpconnectionManager.ttlSeconds"="120"
2626

2727
- name: Delete old packages
2828
continue-on-error: true
@@ -38,7 +38,6 @@ jobs:
3838
org.quickfixj.quickfixj-codegenerator
3939
org.quickfixj.quickfixj-core
4040
org.quickfixj.quickfixj-dictgenerator
41-
org.quickfixj.quickfixj-distribution
4241
org.quickfixj.quickfixj-examples
4342
org.quickfixj.quickfixj-examples-banzai
4443
org.quickfixj.quickfixj-examples-executor
@@ -58,8 +57,9 @@ jobs:
5857
org.quickfixj.quickfixj-orchestration
5958
org.quickfixj.quickfixj-parent
6059
org.quickfixj.quickfixj-perf-test
60+
org.quickfixj.quickfixj-stress-test
6161
6262
- name: Deploy SNAPSHOT
63-
run: ./mvnw deploy -B -V -DskipTests -D"maven.javadoc.skip"="true" -D"java.util.logging.config.file"="${{github.workspace}}/quickfixj-core/src/test/resources/logging.properties" -D"http.keepAlive"="false" -D"maven.wagon.http.pool"="false" -D"maven.wagon.httpconnectionManager.ttlSeconds"="120"
63+
run: ./mvnw deploy -pl '!quickfixj-distribution' -B -V -Dmaven.install.skip=true -DskipTests -D"java.util.logging.config.file"="${{github.workspace}}/quickfixj-core/src/test/resources/logging.properties" -D"http.keepAlive"="false" -D"maven.wagon.http.pool"="false" -D"maven.wagon.httpconnectionManager.ttlSeconds"="120"
6464
env:
6565
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.mvn/wrapper/maven-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
# under the License.
1717
#
1818
# NOTE: maven version should also be changed in pom.xml
19-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip
2020
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar

pom.xml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
<module>quickfixj-all</module>
5757
<module>quickfixj-distribution</module>
5858
<module>quickfixj-perf-test</module>
59-
</modules>
59+
<module>quickfixj-stress-test</module>
60+
</modules>
6061

6162
<properties>
6263
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -65,22 +66,22 @@
6566
<slf4j.version>2.0.17</slf4j.version>
6667
<mockito-core.version>4.11.0</mockito-core.version>
6768
<hamcrest.version>3.0</hamcrest.version>
68-
<junit.jupiter.version>5.14.1</junit.jupiter.version>
69+
<junit.jupiter.version>5.14.2</junit.jupiter.version>
6970
<maven.compiler.source>8</maven.compiler.source>
7071
<maven.compiler.target>8</maven.compiler.target>
7172
<mainClass/>
72-
<maven.version>3.9.11</maven.version> <!-- please also change version in .mvn/wrapper/maven-wrapper.properties -->
73+
<maven.version>3.9.12</maven.version> <!-- please also change version in .mvn/wrapper/maven-wrapper.properties -->
7374
<maven-libs-version>${maven.version}</maven-libs-version>
7475
<maven-plugin-api-version>${maven.version}</maven-plugin-api-version>
75-
<maven-resources-plugin-version>3.3.1</maven-resources-plugin-version>
76+
<maven-resources-plugin-version>3.4.0</maven-resources-plugin-version>
7677
<maven-compiler-plugin-version>3.14.1</maven-compiler-plugin-version>
7778
<maven-jar-plugin-version>3.5.0</maven-jar-plugin-version>
7879
<maven-surefire-plugin-version>3.5.4</maven-surefire-plugin-version>
7980
<maven-pmd-plugin-version>3.28.0</maven-pmd-plugin-version>
80-
<maven-source-plugin-version>3.3.1</maven-source-plugin-version>
81+
<maven-source-plugin-version>3.4.0</maven-source-plugin-version>
8182
<maven-javadoc-plugin-version>3.12.0</maven-javadoc-plugin-version>
8283
<maven-shade-plugin-version>3.6.1</maven-shade-plugin-version>
83-
<maven-assembly-plugin-version>3.7.1</maven-assembly-plugin-version>
84+
<maven-assembly-plugin-version>3.8.0</maven-assembly-plugin-version>
8485
<maven-bundle-plugin-version>5.1.9</maven-bundle-plugin-version>
8586
<maven-gpg-plugin-version>3.2.8</maven-gpg-plugin-version>
8687
<maven-deploy-plugin-version>3.1.4</maven-deploy-plugin-version>
@@ -89,7 +90,7 @@
8990
<maven-shared-utils.version>3.4.2</maven-shared-utils.version>
9091
<file-management.version>3.2.0</file-management.version>
9192
<maven-plugin-annotations.version>3.15.2</maven-plugin-annotations.version>
92-
<maven-plugin-testing-harness.version>3.4.0</maven-plugin-testing-harness.version>
93+
<maven-plugin-testing-harness.version>3.5.0</maven-plugin-testing-harness.version>
9394
<plantuml-maven-plugin-version>1.2</plantuml-maven-plugin-version>
9495
<plantuml-version>8059</plantuml-version>
9596
<xml-maven-plugin-version>1.2.0</xml-maven-plugin-version>
@@ -102,7 +103,9 @@
102103
<orchestra.file>OrchestraFIXLatest.xml</orchestra.file>
103104
<org.quickfixj.orchestra.tools.version>1.0.3</org.quickfixj.orchestra.tools.version>
104105
<jaxen.version>2.0.0</jaxen.version>
105-
<jmh.version>1.37</jmh.version>
106+
<jmh.version>1.37</jmh.version>
107+
<jcstress.version>0.16</jcstress.version>
108+
<hsqldb.version>1.8.0.10</hsqldb.version>
106109
</properties>
107110

108111
<dependencyManagement>
@@ -273,7 +276,7 @@
273276
<version>${maven-compiler-plugin-version}</version>
274277
<inherited>true</inherited>
275278
<configuration>
276-
<forceJavacCompilerUse>true</forceJavacCompilerUse> <!-- https://bugs.openjdk.java.net/browse/JDK-8216202 -->
279+
<forceLegacyJavacApi>true</forceLegacyJavacApi> <!-- https://bugs.openjdk.java.net/browse/JDK-8216202 -->
277280
<meminitial>2g</meminitial>
278281
<maxmem>4g</maxmem>
279282
</configuration>

quickfixj-base/src/main/java/quickfix/FieldType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public enum FieldType {
3030

3131
UNKNOWN,
3232
STRING,
33-
CHAR,
33+
CHAR(Character.class),
3434
PRICE(Double.class),
3535
INT(Integer.class),
3636
AMT(Double.class),

quickfixj-base/src/test/java/quickfix/DataDictionaryTest.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.io.ByteArrayInputStream;
2929
import java.net.URL;
3030
import java.net.URLClassLoader;
31+
import java.util.Locale;
3132

3233
import javax.xml.parsers.DocumentBuilderFactory;
3334

@@ -677,11 +678,17 @@ public void shouldLoadDictionaryWhenExternalDTDisEnabled() throws ConfigError {
677678

678679
@Test
679680
public void shouldFailToLoadDictionaryWhenExternalDTDisDisabled() {
681+
Locale originalLocale = Locale.getDefault();
682+
Locale.setDefault(Locale.US);
680683
try {
681-
new DataDictionary("FIX_External_DTD.xml");
682-
fail("should fail to load dictionary with external DTD");
683-
} catch (ConfigError e) {
684-
assertEquals("External DTD: Failed to read external DTD 'mathml.dtd', because 'http' access is not allowed due to restriction set by the accessExternalDTD property.", e.getCause().getCause().getMessage());
684+
try {
685+
new DataDictionary("FIX_External_DTD.xml");
686+
fail("should fail to load dictionary with external DTD");
687+
} catch (ConfigError e) {
688+
assertEquals("External DTD: Failed to read external DTD 'mathml.dtd', because 'http' access is not allowed due to restriction set by the accessExternalDTD property.", e.getCause().getCause().getMessage());
689+
}
690+
} finally {
691+
Locale.setDefault(originalLocale);
685692
}
686693
}
687694

quickfixj-core/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
<dependency>
103103
<groupId>hsqldb</groupId>
104104
<artifactId>hsqldb</artifactId>
105-
<version>1.8.0.10</version>
105+
<version>${hsqldb.version}</version>
106106
<scope>test</scope>
107107
</dependency>
108108
<dependency>
@@ -120,7 +120,7 @@
120120
<dependency>
121121
<groupId>io.netty</groupId>
122122
<artifactId>netty-example</artifactId>
123-
<version>4.2.7.Final</version>
123+
<version>4.2.9.Final</version>
124124
<scope>test</scope>
125125
</dependency>
126126
<dependency>

quickfixj-core/src/main/java/quickfix/DefaultMessageFactory.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,12 @@ public void addFactory(String beginString, String factoryClassName) throws Class
118118
// try using our own classloader
119119
factoryClass = (Class<? extends MessageFactory>) Class.forName(factoryClassName);
120120
} catch (ClassNotFoundException e) {
121-
// try using context classloader (i.e. allow caller to specify it)
122-
Thread.currentThread().getContextClassLoader().loadClass(factoryClassName);
121+
// try using context classloader (i.e. allow caller to specify it)
122+
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
123+
124+
if (contextClassLoader != null) {
125+
factoryClass = (Class<? extends MessageFactory>) contextClassLoader.loadClass(factoryClassName);
126+
}
123127
}
124128
// if factory is found, add it
125129
if (factoryClass != null) {

quickfixj-core/src/main/java/quickfix/JdbcStore.java

Lines changed: 68 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ class JdbcStore implements MessageStore {
4343
private final String defaultSessionIdPropertyValue;
4444
private final boolean persistMessages;
4545

46-
private String SQL_UPDATE_SEQNUMS;
46+
private String SQL_UPDATE_INCOMING_SEQNUM;
47+
private String SQL_UPDATE_OUTGOING_SEQNUM;
4748
private String SQL_INSERT_SESSION;
4849
private String SQL_GET_SEQNUMS;
4950
private String SQL_UPDATE_MESSAGE;
@@ -54,19 +55,9 @@ class JdbcStore implements MessageStore {
5455

5556
public JdbcStore(SessionSettings settings, SessionID sessionID, DataSource ds) throws Exception {
5657
this.sessionID = sessionID;
57-
if (settings.isSetting(sessionID, SETTING_JDBC_STORE_SESSIONS_TABLE_NAME)) {
58-
sessionTableName = settings
59-
.getString(sessionID, SETTING_JDBC_STORE_SESSIONS_TABLE_NAME);
60-
} else {
61-
sessionTableName = DEFAULT_SESSION_TABLE_NAME;
62-
}
6358

64-
if (settings.isSetting(sessionID, SETTING_JDBC_STORE_MESSAGES_TABLE_NAME)) {
65-
messageTableName = settings
66-
.getString(sessionID, SETTING_JDBC_STORE_MESSAGES_TABLE_NAME);
67-
} else {
68-
messageTableName = DEFAULT_MESSAGE_TABLE_NAME;
69-
}
59+
sessionTableName = getSessionTableName(settings, sessionID);
60+
messageTableName = getMessageTableName(settings, sessionID);
7061

7162
if (settings.isSetting(sessionID, SETTING_JDBC_SESSION_ID_DEFAULT_PROPERTY_VALUE)) {
7263
defaultSessionIdPropertyValue = settings.getString(sessionID,
@@ -90,34 +81,72 @@ public JdbcStore(SessionSettings settings, SessionID sessionID, DataSource ds) t
9081
loadCache();
9182
}
9283

93-
private void setSqlStrings() {
94-
String idWhereClause = JdbcUtil.getIDWhereClause(extendedSessionIdSupported);
95-
String idColumns = JdbcUtil.getIDColumns(extendedSessionIdSupported);
96-
String idPlaceholders = JdbcUtil.getIDPlaceholders(extendedSessionIdSupported);
84+
public static String getSessionTableName(SessionSettings settings, SessionID sessionID) throws ConfigError {
85+
if (settings.isSetting(sessionID, SETTING_JDBC_STORE_SESSIONS_TABLE_NAME)) {
86+
return settings.getString(sessionID, SETTING_JDBC_STORE_SESSIONS_TABLE_NAME);
87+
} else {
88+
return DEFAULT_SESSION_TABLE_NAME;
89+
}
90+
}
9791

98-
SQL_UPDATE_SEQNUMS = "UPDATE " + sessionTableName + " SET incoming_seqnum=?, "
99-
+ "outgoing_seqnum=? WHERE " + idWhereClause;
92+
public static String getMessageTableName(SessionSettings settings, SessionID sessionID) throws ConfigError {
93+
if (settings.isSetting(sessionID, SETTING_JDBC_STORE_MESSAGES_TABLE_NAME)) {
94+
return settings.getString(sessionID, SETTING_JDBC_STORE_MESSAGES_TABLE_NAME);
95+
} else {
96+
return DEFAULT_MESSAGE_TABLE_NAME;
97+
}
98+
}
10099

101-
SQL_INSERT_SESSION = "INSERT INTO " + sessionTableName + " (" + idColumns
102-
+ ", creation_time,incoming_seqnum, outgoing_seqnum) VALUES (" + idPlaceholders
103-
+ ",?,?,?)";
100+
public static String getUpdateIncomingSequenceNumberSql(String sessionTableName, String idWhereClause) {
101+
return "UPDATE " + sessionTableName + " SET incoming_seqnum=? WHERE " + idWhereClause;
102+
}
104103

105-
SQL_GET_SEQNUMS = "SELECT creation_time, incoming_seqnum, outgoing_seqnum FROM "
106-
+ sessionTableName + " WHERE " + idWhereClause;
104+
public static String getUpdateOutgoingSequenceNumberSql(String sessionTableName, String idWhereClause) {
105+
return "UPDATE " + sessionTableName + " SET outgoing_seqnum=? WHERE " + idWhereClause;
106+
}
107+
108+
public static String getInsertSessionSql(String sessionTableName, String idColumns, String idPlaceholders) {
109+
return "INSERT INTO " + sessionTableName + " (" + idColumns + ", creation_time,incoming_seqnum, outgoing_seqnum) VALUES (" + idPlaceholders + ",?,?,?)";
110+
}
111+
112+
public static String getSequenceNumsSql(String sessionTableName, String idWhereClause) {
113+
return "SELECT creation_time, incoming_seqnum, outgoing_seqnum FROM " + sessionTableName + " WHERE " + idWhereClause;
114+
}
115+
116+
public static String getUpdateMessageSql(String messageTableName, String idWhereClause) {
117+
return "UPDATE " + messageTableName + " SET message=? " + "WHERE " + idWhereClause + " and msgseqnum=?";
118+
}
119+
120+
public static String getInsertMessageSql(String messageTableName, String idColumns, String idPlaceholders) {
121+
return "INSERT INTO " + messageTableName + " (" + idColumns + ", msgseqnum,message) VALUES (" + idPlaceholders + ",?,?)";
122+
}
107123

108-
SQL_UPDATE_MESSAGE = "UPDATE " + messageTableName + " SET message=? " + "WHERE "
109-
+ idWhereClause + " and msgseqnum=?";
124+
public static String getMessagesSql(String messageTableName, String idWhereClause) {
125+
return "SELECT message FROM " + messageTableName + " WHERE " + idWhereClause + " and msgseqnum>=? and msgseqnum<=? " + "ORDER BY msgseqnum";
126+
}
110127

111-
SQL_INSERT_MESSAGE = "INSERT INTO " + messageTableName + " (" + idColumns
112-
+ ", msgseqnum,message) VALUES (" + idPlaceholders + ",?,?)";
128+
public static String getUpdateSessionSql(String sessionTableName, String idWhereClause) {
129+
return "UPDATE " + sessionTableName + " SET creation_time=?, " + "incoming_seqnum=?, outgoing_seqnum=? " + "WHERE " + idWhereClause;
130+
}
113131

114-
SQL_GET_MESSAGES = "SELECT message FROM " + messageTableName + " WHERE " + idWhereClause
115-
+ " and msgseqnum>=? and msgseqnum<=? " + "ORDER BY msgseqnum";
132+
public static String getDeleteMessagesSql(String messageTableName, String idWhereClause) {
133+
return "DELETE FROM " + messageTableName + " WHERE " + idWhereClause;
134+
}
116135

117-
SQL_UPDATE_SESSION = "UPDATE " + sessionTableName + " SET creation_time=?, "
118-
+ "incoming_seqnum=?, outgoing_seqnum=? " + "WHERE " + idWhereClause;
136+
private void setSqlStrings() {
137+
String idWhereClause = JdbcUtil.getIDWhereClause(extendedSessionIdSupported);
138+
String idColumns = JdbcUtil.getIDColumns(extendedSessionIdSupported);
139+
String idPlaceholders = JdbcUtil.getIDPlaceholders(extendedSessionIdSupported);
119140

120-
SQL_DELETE_MESSAGES = "DELETE FROM " + messageTableName + " WHERE " + idWhereClause;
141+
SQL_UPDATE_INCOMING_SEQNUM = getUpdateIncomingSequenceNumberSql(sessionTableName, idWhereClause);
142+
SQL_UPDATE_OUTGOING_SEQNUM = getUpdateOutgoingSequenceNumberSql(sessionTableName, idWhereClause);
143+
SQL_INSERT_SESSION = getInsertSessionSql(sessionTableName, idColumns, idPlaceholders);
144+
SQL_GET_SEQNUMS = getSequenceNumsSql(sessionTableName, idWhereClause);
145+
SQL_UPDATE_MESSAGE = getUpdateMessageSql(messageTableName, idWhereClause);
146+
SQL_INSERT_MESSAGE = getInsertMessageSql(messageTableName, idColumns, idPlaceholders);
147+
SQL_GET_MESSAGES = getMessagesSql(messageTableName, idWhereClause);
148+
SQL_UPDATE_SESSION = getUpdateSessionSql(sessionTableName, idWhereClause);
149+
SQL_DELETE_MESSAGES = getDeleteMessagesSql(messageTableName, idWhereClause);
121150
}
122151

123152
private void loadCache() throws SQLException, IOException {
@@ -238,7 +267,6 @@ public void get(int startSequence, int endSequence, Collection<String> messages)
238267
public boolean set(int sequence, String message) throws IOException {
239268
Connection connection = null;
240269
PreparedStatement insert = null;
241-
ResultSet rs = null;
242270
try {
243271
connection = dataSource.getConnection();
244272
insert = connection.prepareStatement(SQL_INSERT_MESSAGE);
@@ -263,7 +291,6 @@ public boolean set(int sequence, String message) throws IOException {
263291
}
264292
}
265293
} finally {
266-
JdbcUtil.close(sessionID, rs);
267294
JdbcUtil.close(sessionID, insert);
268295
JdbcUtil.close(sessionID, connection);
269296
}
@@ -272,23 +299,22 @@ public boolean set(int sequence, String message) throws IOException {
272299

273300
public void setNextSenderMsgSeqNum(int next) throws IOException {
274301
cache.setNextSenderMsgSeqNum(next);
275-
storeSequenceNumbers();
302+
storeSequenceNumber(SQL_UPDATE_OUTGOING_SEQNUM, next);
276303
}
277304

278305
public void setNextTargetMsgSeqNum(int next) throws IOException {
279306
cache.setNextTargetMsgSeqNum(next);
280-
storeSequenceNumbers();
307+
storeSequenceNumber(SQL_UPDATE_INCOMING_SEQNUM, next);
281308
}
282309

283-
private void storeSequenceNumbers() throws IOException {
310+
private void storeSequenceNumber(String sequenceUpdateSql, int sequence) throws IOException {
284311
Connection connection = null;
285312
PreparedStatement update = null;
286313
try {
287314
connection = dataSource.getConnection();
288-
update = connection.prepareStatement(SQL_UPDATE_SEQNUMS);
289-
update.setInt(1, cache.getNextTargetMsgSeqNum());
290-
update.setInt(2, cache.getNextSenderMsgSeqNum());
291-
setSessionIdParameters(update, 3);
315+
update = connection.prepareStatement(sequenceUpdateSql);
316+
update.setInt(1, sequence);
317+
setSessionIdParameters(update, 2);
292318
update.execute();
293319
} catch (SQLException e) {
294320
throw new IOException(e.getMessage(), e);

quickfixj-core/src/main/java/quickfix/MemoryStore.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ public Calendar getCreationTimeCalendar() throws IOException {
7474
return creationTime;
7575
}
7676

77-
/* package */void setCreationTime(Calendar creationTime) {
77+
void setCreationTime(Calendar creationTime) {
7878
this.creationTime = creationTime;
7979
}
8080

81-
public int getNextSenderMsgSeqNum() throws IOException {
81+
public int getNextSenderMsgSeqNum() {
8282
return nextSenderMsgSeqNum;
8383
}
8484

85-
public int getNextTargetMsgSeqNum() throws IOException {
85+
public int getNextTargetMsgSeqNum() {
8686
return nextTargetMsgSeqNum;
8787
}
8888

quickfixj-core/src/main/java/quickfix/mina/SessionConnector.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ private String getLogSuffix(SessionID sessionID, IoSession protocolSession) {
311311
}
312312

313313
protected void startSessionTimer() {
314+
// Check if a session timer is already running to avoid creating multiple timers
315+
if (checkSessionTimerRunning()) {
316+
return;
317+
}
314318
Runnable timerTask = new SessionTimerTask();
315319
if (shortLivedExecutor != null) {
316320
timerTask = new DelegatingTask(timerTask, shortLivedExecutor);

0 commit comments

Comments
 (0)