diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpRequest.java b/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpRequest.java index e05f992c97..9cd57c08c0 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpRequest.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package org.springframework.http.server.reactive; import java.net.InetSocketAddress; import java.net.URI; import java.net.URISyntaxException; +import java.util.concurrent.atomic.AtomicLong; import javax.net.ssl.SSLSession; @@ -47,6 +48,9 @@ import org.springframework.util.MultiValueMap; */ class ReactorServerHttpRequest extends AbstractServerHttpRequest { + private static final AtomicLong logPrefixIndex = new AtomicLong(0); + + private final HttpServerRequest request; private final NettyDataBufferFactory bufferFactory; @@ -181,8 +185,11 @@ class ReactorServerHttpRequest extends AbstractServerHttpRequest { @Override @Nullable protected String initId() { - return this.request instanceof Connection ? - ((Connection) this.request).channel().id().asShortText() : null; + if (this.request instanceof Connection) { + return ((Connection) this.request).channel().id().asShortText() + + "-" + logPrefixIndex.incrementAndGet(); + } + return null; } }