Skip to content

Commit aacfd86

Browse files
authored
Merge branch 'development' into feature/prerequisites
2 parents 0da2e36 + 285d29f commit aacfd86

38 files changed

+252
-188
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
4.15.0 (Apr 18, 2025)
2+
- Prevent polling threads from starting when the SDK calls destroy method.
3+
- Added a new optional argument to the client `getTreatment` methods to allow passing additional evaluation options, such as a map of properties to append to the generated impressions sent to Split backend. Read more in our docs.
4+
15
4.14.0 (Jan 17, 2025)
26
- Added support for the new impressions tracking toggle available on feature flags, both respecting the setting and including the new field being returned on SplitView type objects. Read more in our docs.
37
- Cleaned unused imports to fix a collision issue.

client/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<parent>
66
<groupId>io.split.client</groupId>
77
<artifactId>java-client-parent</artifactId>
8-
<version>4.14.0</version>
8+
<version>4.15.0</version>
99
</parent>
10-
<version>4.14.0</version>
10+
<version>4.15.0</version>
1111
<artifactId>java-client</artifactId>
1212
<packaging>jar</packaging>
1313
<name>Java Client</name>

client/src/main/java/io/split/Spec.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ private Spec() {
66
// restrict instantiation
77
}
88

9-
// TODO: Change the schema to 1.3 when updating splitclient
109
public static final String SPEC_1_3 = "1.3";
1110
public static final String SPEC_1_1 = "1.1";
1211
}

client/src/main/java/io/split/client/HttpSplitChangeFetcher.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
public final class HttpSplitChangeFetcher implements SplitChangeFetcher {
3434
private static final Logger _log = LoggerFactory.getLogger(HttpSplitChangeFetcher.class);
3535

36-
private final Object _lock = new Object();
3736
private static final String SINCE = "since";
3837
private static final String RB_SINCE = "rbSince";
3938
private static final String TILL = "till";

client/src/main/java/io/split/client/JsonLocalhostSplitChangeFetcher.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ private SplitChange processSplitChange(SplitChange splitChange, long changeNumbe
6161
_log.warn("The till is lower than the change number or different to -1");
6262
return null;
6363
}
64+
6465
byte [] currHashFeatureFlags = getStringDigest(splitChange.featureFlags.d.toString());
6566
byte [] currHashRuleBasedSegments = getStringDigest(splitChange.ruleBasedSegments.d.toString());
6667
//if sha exist and is equal to before sha, or if till is equal to default till returns the same segmentChange with till equals to storage CN
@@ -79,10 +80,10 @@ private SplitChange processSplitChange(SplitChange splitChange, long changeNumbe
7980
return splitChangeToProcess;
8081
}
8182

82-
private byte[] getStringDigest(String Json) throws NoSuchAlgorithmException {
83+
private byte[] getStringDigest(String json) throws NoSuchAlgorithmException {
8384
MessageDigest digest = MessageDigest.getInstance("SHA-1");
8485
digest.reset();
85-
digest.update(Json.getBytes());
86+
digest.update(json.getBytes());
8687
// calculate the json sha
8788
return digest.digest();
8889
}

client/src/main/java/io/split/client/LegacyLocalhostSplitChangeFetcher.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,7 @@ public SplitChange fetch(long since, long sinceRBS, FetchOptions options) {
7070
split.trafficAllocation = LocalhostConstants.SIZE_100;
7171
split.trafficAllocationSeed = LocalhostConstants.SIZE_1;
7272

73-
Condition condition;
74-
if (featureTreatment.length == 2) {
75-
condition = LocalhostSanitizer.createCondition(null, featureTreatment[1]);
76-
} else {
77-
condition = LocalhostSanitizer.createCondition(featureTreatment[2], featureTreatment[1]);
78-
}
73+
Condition condition = checkCondition(featureTreatment);
7974
if(condition.conditionType != ConditionType.ROLLOUT){
8075
split.conditions.add(0, condition);
8176
} else {
@@ -103,4 +98,14 @@ public SplitChange fetch(long since, long sinceRBS, FetchOptions options) {
10398
throw new IllegalStateException("Problem fetching splitChanges: " + e.getMessage(), e);
10499
}
105100
}
101+
102+
private Condition checkCondition(String[] featureTreatment) {
103+
Condition condition;
104+
if (featureTreatment.length == 2) {
105+
condition = LocalhostSanitizer.createCondition(null, featureTreatment[1]);
106+
} else {
107+
condition = LocalhostSanitizer.createCondition(featureTreatment[2], featureTreatment[1]);
108+
}
109+
return condition;
110+
}
106111
}

client/src/main/java/io/split/client/SplitClientImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ private String validateProperties(Map<String, Object> properties) {
552552

553553
ImpressionPropertiesValidator.ImpressionPropertiesValidatorResult iPValidatorResult = ImpressionPropertiesValidator.propertiesAreValid(
554554
properties);
555-
return new GsonBuilder().create().toJson(iPValidatorResult.getValue()).toString();
555+
return new GsonBuilder().create().toJson(iPValidatorResult.getValue());
556556
}
557557

558558
private Map<String, SplitResult> getTreatmentsWithConfigInternal(String matchingKey, String bucketingKey, List<String> featureFlagNames,

client/src/main/java/io/split/client/SplitFactoryImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public class SplitFactoryImpl implements SplitFactory {
130130
private static final org.slf4j.Logger _log = LoggerFactory.getLogger(SplitFactoryImpl.class);
131131
private static final String LEGACY_LOG_MESSAGE = "The sdk initialize in localhost mode using Legacy file. The splitFile or "
132132
+
133-
"inputStream doesn't add it to the config.";
133+
"inputStream are not added to the config.";
134134
private final static long SSE_CONNECT_TIMEOUT = 30000;
135135
private final static long SSE_SOCKET_TIMEOUT = 70000;
136136

@@ -403,7 +403,7 @@ protected SplitFactoryImpl(SplitClientConfig config) {
403403
SegmentCache segmentCache = new SegmentCacheInMemoryImpl();
404404
FlagSetsFilter flagSetsFilter = new FlagSetsFilterImpl(config.getSetsFilter());
405405
SplitCache splitCache = new InMemoryCacheImp(flagSetsFilter);
406-
RuleBasedSegmentCache _ruleBasedSegmentCache = new RuleBasedSegmentCacheInMemoryImp();
406+
RuleBasedSegmentCache ruleBasedSegmentCache = new RuleBasedSegmentCacheInMemoryImp();
407407
_splitCache = splitCache;
408408
_gates = new SDKReadinessGates();
409409
_segmentCache = segmentCache;
@@ -422,15 +422,15 @@ protected SplitFactoryImpl(SplitClientConfig config) {
422422
_telemetryStorageProducer,
423423
_splitCache,
424424
config.getThreadFactory(),
425-
_ruleBasedSegmentCache);
425+
ruleBasedSegmentCache);
426426

427427
// SplitFetcher
428428
SplitChangeFetcher splitChangeFetcher = createSplitChangeFetcher(config);
429429
SplitParser splitParser = new SplitParser();
430430
RuleBasedSegmentParser ruleBasedSegmentParser = new RuleBasedSegmentParser();
431431

432432
_splitFetcher = new SplitFetcherImp(splitChangeFetcher, splitParser, splitCache, _telemetryStorageProducer,
433-
flagSetsFilter, ruleBasedSegmentParser, _ruleBasedSegmentCache);
433+
flagSetsFilter, ruleBasedSegmentParser, ruleBasedSegmentCache);
434434

435435
// SplitSynchronizationTask
436436
_splitSynchronizationTask = new SplitSynchronizationTask(_splitFetcher, splitCache,
@@ -442,7 +442,7 @@ protected SplitFactoryImpl(SplitClientConfig config) {
442442
_impressionsManager, null, null, null);
443443

444444
// Evaluator
445-
_evaluator = new EvaluatorImp(splitCache, segmentCache, _ruleBasedSegmentCache);
445+
_evaluator = new EvaluatorImp(splitCache, segmentCache, ruleBasedSegmentCache);
446446

447447
EventsStorage eventsStorage = new NoopEventsStorageImp();
448448

client/src/main/java/io/split/client/dtos/ChangeDto.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.split.client.dtos;
22

3-
import java.util.ArrayList;
43
import java.util.List;
54

65
public class ChangeDto<T> {

client/src/main/java/io/split/client/dtos/EvaluationOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ public EvaluationOptions(Map<String, Object> properties) {
1010
}
1111
public Map<String, Object> getProperties() {
1212
return _properties;
13-
};
13+
}
1414
}

0 commit comments

Comments
 (0)