File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
frameworks/Java/inverno/src/main/java/com/techempower/inverno/benchmark/internal Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 3
3
import java .time .ZonedDateTime ;
4
4
import java .time .format .DateTimeFormatter ;
5
5
import java .util .Collections ;
6
+ import java .util .concurrent .CompletableFuture ;
6
7
import java .util .concurrent .ThreadLocalRandom ;
7
8
import java .util .concurrent .TimeUnit ;
8
9
import java .util .function .Supplier ;
@@ -280,6 +281,8 @@ public void handle_updates(Exchange exchange) throws HttpException {
280
281
private static final String DB_SELECT_FORTUNE = "SELECT id, message from FORTUNE" ;
281
282
private static final CharSequence MEDIA_TEXT_HTML_UTF8 = AsciiString .cached ("text/html; charset=utf-8" );
282
283
284
+ private static final FortunesTemplate .Renderer <CompletableFuture <ByteBuf >> FORTUNES_RENDERER = FortunesTemplate .bytebuf (() -> Unpooled .unreleasableBuffer (Unpooled .buffer ()));
285
+
283
286
public void handle_fortunes (Exchange exchange ) throws HttpException {
284
287
exchange .response ()
285
288
.headers (h -> h
@@ -296,7 +299,7 @@ public void handle_fortunes(Exchange exchange) throws HttpException {
296
299
.flatMap (fortunes -> {
297
300
fortunes .add (new Fortune (0 , "Additional fortune added at request time." ));
298
301
Collections .sort (fortunes );
299
- return Mono .fromFuture (() -> FortunesTemplate . bytebuf (() -> Unpooled . unreleasableBuffer ( Unpooled . buffer ())) .render (fortunes ));
302
+ return Mono .fromFuture (() -> FORTUNES_RENDERER .render (fortunes ));
300
303
})
301
304
);
302
305
}
You can’t perform that action at this time.
0 commit comments