Skip to content

Commit ab46556

Browse files
authored
Merge branch 'main' into zero-copy-contexts
2 parents b4e2eec + 700d0f4 commit ab46556

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"lib/java-server-sdk-redis-store": "3.0.1",
44
"lib/shared/common": "2.1.1",
55
"lib/shared/internal": "1.5.0",
6-
"lib/sdk/server": "7.9.0"
6+
"lib/sdk/server": "7.9.1"
77
}

lib/sdk/server/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to the LaunchDarkly Java SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
44

5+
## [7.9.1](https://github.com/launchdarkly/java-core/compare/launchdarkly-java-server-sdk-7.9.0...launchdarkly-java-server-sdk-7.9.1) (2025-06-20)
6+
7+
8+
### Performance Improvements
9+
10+
* optimize EvaluatorWithHooks ([#73](https://github.com/launchdarkly/java-core/issues/73)) ([6b42592](https://github.com/launchdarkly/java-core/commit/6b42592c7efd84eae7bb13977a5a3f3fb2237c9c))
11+
512
## [7.9.0](https://github.com/launchdarkly/java-core/compare/launchdarkly-java-server-sdk-7.8.0...launchdarkly-java-server-sdk-7.9.0) (2025-05-23)
613

714

lib/sdk/server/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#x-release-please-start-version
2-
version=7.9.0
2+
version=7.9.1
33
#x-release-please-end
44

55
# See https://github.com/gradle/gradle/issues/11308 regarding the following property

lib/sdk/server/src/main/java/com/launchdarkly/sdk/server/EvaluatorWithHooks.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,26 @@ class EvaluatorWithHooks implements EvaluatorInterface {
3737
public EvalResultAndFlag evalAndFlag(String method, String featureKey, LDContext context, LDValue defaultValue, LDValueType requireType, EvaluationOptions options) {
3838
// Each hook will have an opportunity to provide series data to carry along to later stages. This list
3939
// is to track that data.
40-
List<Map> seriesDataList = new ArrayList<>(hooks.size());
40+
int size = hooks.size();
41+
List<Map> seriesDataList = new ArrayList<>(size);
4142

4243
EvaluationSeriesContext seriesContext = new EvaluationSeriesContext(method, featureKey, context, defaultValue);
43-
for (int i = 0; i < hooks.size(); i++) {
44+
Map<String, Object> emptyMap = Collections.emptyMap();
45+
for (int i = 0; i < size; i++) {
4446
Hook currentHook = hooks.get(i);
4547
try {
46-
Map<String, Object> seriesData = currentHook.beforeEvaluation(seriesContext, Collections.emptyMap());
47-
seriesDataList.add(Collections.unmodifiableMap(seriesData)); // make data immutable
48+
Map<String, Object> seriesData = currentHook.beforeEvaluation(seriesContext, emptyMap);
49+
seriesDataList.add(seriesData.isEmpty() ? emptyMap : Collections.unmodifiableMap(seriesData)); // make data immutable
4850
} catch (Exception e) {
49-
seriesDataList.add(Collections.emptyMap()); // since the provided hook failed to execute, we default the series data to an empty map in this case
51+
seriesDataList.add(emptyMap); // since the provided hook failed to execute, we default the series data to an empty map in this case
5052
logger.error("During evaluation of flag \"{}\". Stage \"BeforeEvaluation\" of hook \"{}\" reported error: {}", featureKey, currentHook.getMetadata().getName(), e.toString());
5153
}
5254
}
5355

5456
EvalResultAndFlag result = underlyingEvaluator.evalAndFlag(method, featureKey, context, defaultValue, requireType, options);
5557

5658
// Invoke hooks in reverse order and give them back the series data they gave us.
57-
for (int i = hooks.size() - 1; i >= 0; i--) {
59+
for (int i = size - 1; i >= 0; i--) {
5860
Hook currentHook = hooks.get(i);
5961
try {
6062
currentHook.afterEvaluation(seriesContext, seriesDataList.get(i), result.getResult().getAnyType());

lib/sdk/server/src/main/java/com/launchdarkly/sdk/server/Version.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ private Version() {}
55

66
// This constant is updated automatically by our Gradle script during a release, if the project version has changed
77
// x-release-please-start-version
8-
static final String SDK_VERSION = "7.9.0";
8+
static final String SDK_VERSION = "7.9.1";
99
// x-release-please-end
1010
}

0 commit comments

Comments
 (0)