Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

Commit 08a69ec

Browse files
authored
[java] Create new Fortune object in scope of request (#10655)
The new fortune object must be constructed in the scope of the request, not as a constant: > Within the scope of the request, a new Fortune object must be constructed and added to the list. https://github.com/TechEmpower/FrameworkBenchmarks/wiki/Project-Information-Framework-Tests-Overview#fortunes
1 parent a5f62b7 commit 08a69ec

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

  • frameworks/Java/helidon/reactive/src/main/java/io/helidon/benchmark/reactive/services

frameworks/Java/helidon/reactive/src/main/java/io/helidon/benchmark/reactive/services/FortuneService.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
public class FortuneService implements Service, Handler {
1818

19-
private static final Fortune ADDITIONAL_FORTUNE = new Fortune(0, "Additional fortune added at request time.");
20-
2119
private final DbRepository repository;
2220

2321
public FortuneService(DbRepository repository) {
@@ -34,7 +32,7 @@ public void accept(ServerRequest req, ServerResponse res) {
3432
res.headers().contentType(MediaType.TEXT_HTML.withCharset(StandardCharsets.UTF_8.name()));
3533
repository.getFortunes()
3634
.forSingle(fortuneList -> {
37-
fortuneList.add(ADDITIONAL_FORTUNE);
35+
fortuneList.add(new Fortune(0, "Additional fortune added at request time."));
3836
fortuneList.sort(Comparator.comparing(Fortune::getMessage));
3937
res.headers().contentType(MediaType.TEXT_HTML.withCharset(StandardCharsets.UTF_8.name()));
4038
res.send(fortunes.template(fortuneList)

0 commit comments

Comments
 (0)