Skip to content

Commit 1b9cd84

Browse files
author
dxcity
committed
tagging release 3.286
1 parent 8749664 commit 1b9cd84

File tree

55 files changed

+446
-107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+446
-107
lines changed

ReleaseNotes.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11

2+
QDS 3.286:
3+
4+
* [QD-1231] HistorySubscriptionFilter performance improvement
5+
* [QD-1228] Add connectOrder property to ClientSocketConnector
6+
- defines order of considering specified server addresses on connect/reconnect.
7+
Supported modes: shuffle (default), random, ordered, priority
8+
29
QDS 3.285:
310

411
* [QD-1229] Improve reportCounters JMX operation to provide top stats of specified size

auth/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<parent>
1515
<artifactId>QD</artifactId>
1616
<groupId>com.devexperts.qd</groupId>
17-
<version>3.285</version>
17+
<version>3.286</version>
1818
<relativePath>../pom.xml</relativePath>
1919
</parent>
2020
<modelVersion>4.0.0</modelVersion>

dxfeed-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<parent>
1515
<artifactId>QD</artifactId>
1616
<groupId>com.devexperts.qd</groupId>
17-
<version>3.285</version>
17+
<version>3.286</version>
1818
<relativePath>../pom.xml</relativePath>
1919
</parent>
2020
<modelVersion>4.0.0</modelVersion>

dxfeed-bin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<parent>
1515
<artifactId>QD</artifactId>
1616
<groupId>com.devexperts.qd</groupId>
17-
<version>3.285</version>
17+
<version>3.286</version>
1818
<relativePath>../pom.xml</relativePath>
1919
</parent>
2020
<modelVersion>4.0.0</modelVersion>

dxfeed-codegen-verify/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<parent>
1515
<artifactId>QD</artifactId>
1616
<groupId>com.devexperts.qd</groupId>
17-
<version>3.285</version>
17+
<version>3.286</version>
1818
</parent>
1919
<modelVersion>4.0.0</modelVersion>
2020

dxfeed-codegen/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<parent>
1515
<artifactId>QD</artifactId>
1616
<groupId>com.devexperts.qd</groupId>
17-
<version>3.285</version>
17+
<version>3.286</version>
1818
<relativePath>../pom.xml</relativePath>
1919
</parent>
2020
<modelVersion>4.0.0</modelVersion>

dxfeed-impl/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<parent>
1515
<artifactId>QD</artifactId>
1616
<groupId>com.devexperts.qd</groupId>
17-
<version>3.285</version>
17+
<version>3.286</version>
1818
</parent>
1919
<modelVersion>4.0.0</modelVersion>
2020

dxfeed-impl/src/main/java/com/dxfeed/api/impl/DXEndpointImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ public void reconnect() {
313313
synchronized (lock) {
314314
if (isClosed() || qdEndpoint.isClosed())
315315
return;
316-
qdEndpoint.restartActiveConnectors();
316+
qdEndpoint.reconnectActiveConnectors();
317317
}
318318
}
319319

dxfeed-impl/src/main/java/com/dxfeed/api/impl/HistorySubscriptionFilterImpl.java

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import com.dxfeed.event.option.impl.TheoPriceMapping;
2525
import com.dxfeed.event.option.impl.UnderlyingMapping;
2626

27+
import java.util.Arrays;
28+
2729
@ServiceProvider(order = 100)
2830
public class HistorySubscriptionFilterImpl implements HistorySubscriptionFilter {
2931

@@ -41,6 +43,7 @@ public class HistorySubscriptionFilterImpl implements HistorySubscriptionFilter
4143

4244

4345
private final SynchronizedIndexedSet<DataRecord, RecordLimit> maxRecordCounts = SynchronizedIndexedSet.create(RecordLimit::getRecord);
46+
private volatile RecordLimit[] maxRecordCache = new RecordLimit[256];
4447

4548
@Override
4649
public long getMinHistoryTime(DataRecord record, int cipher, String symbol) {
@@ -49,10 +52,25 @@ public long getMinHistoryTime(DataRecord record, int cipher, String symbol) {
4952

5053
@Override
5154
public int getMaxRecordCount(DataRecord record, int cipher, String symbol) {
52-
RecordLimit recordLimit = maxRecordCounts.getByKey(record);
53-
if (recordLimit != null)
54-
return recordLimit.limit;
55+
// Cache is intentionally NOT synchronized in any way. Only minimal array visibility is provided.
56+
// Concurrent threads independently compute same result and reach eventual consistency in a stable environment.
57+
int id = record.getId();
58+
RecordLimit[] cache = maxRecordCache; // Atomic volatile read.
59+
if (id >= cache.length) {
60+
cache = Arrays.copyOf(cache, Math.max(cache.length * 2, id + 1));
61+
maxRecordCache = cache; // Atomic volatile write.
62+
}
63+
RecordLimit limit = cache[id];
64+
if (limit == null || limit.getRecord() != record) {
65+
limit = maxRecordCounts.getByKey(record);
66+
if (limit == null)
67+
limit = maxRecordCounts.putIfAbsentAndGet(createRecordLimit(record));
68+
cache[id] = limit;
69+
}
70+
return limit.getLimit();
71+
}
5572

73+
private RecordLimit createRecordLimit(DataRecord record) {
5674
int defaultMaxRecordCount;
5775
if (record.getMapping(CandleMapping.class) != null) {
5876
defaultMaxRecordCount = candleMaxRecordCount;
@@ -74,8 +92,7 @@ public int getMaxRecordCount(DataRecord record, int cipher, String symbol) {
7492
//event property >= category property >= old-fashioned property
7593
String propName = generatePropertyName(record);
7694
int maxRecordCount = SystemProperties.getIntProperty(HistorySubscriptionFilterImpl.class, propName, defaultMaxRecordCount);
77-
maxRecordCounts.put(new RecordLimit(record, maxRecordCount));
78-
return maxRecordCount;
95+
return new RecordLimit(record, maxRecordCount);
7996
}
8097

8198
@Override
@@ -94,13 +111,17 @@ private static class RecordLimit {
94111
private final DataRecord record;
95112
private final int limit;
96113

97-
private RecordLimit(DataRecord record, int limit) {
114+
RecordLimit(DataRecord record, int limit) {
98115
this.record = record;
99116
this.limit = limit;
100117
}
101118

102119
DataRecord getRecord() {
103120
return record;
104121
}
122+
123+
public int getLimit() {
124+
return limit;
125+
}
105126
}
106127
}

0 commit comments

Comments
 (0)