Skip to content

Commit

Permalink
checkstyle
Browse files Browse the repository at this point in the history
Signed-off-by: David Kral <[email protected]>
  • Loading branch information
Verdent committed Oct 18, 2024
1 parent 5d4c5e4 commit eefca6f
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class Http1ConnectionCache extends ClientConnectionCache {
private static final Duration QUEUE_TIMEOUT = Duration.ofMillis(10);
private static final Http1ConnectionCacheConfig EMPTY_CONFIG = Http1ConnectionCacheConfig.create();
private static final Http1ConnectionCache SHARED = new Http1ConnectionCache(true,
Http1ClientImpl.globalConfig().connectionCacheConfig());
Http1ClientImpl.globalConfig()
.connectionCacheConfig());
private final ConnectionCreationStrategy connectionCreationStrategy;
private final Duration keepAliveWaiting;
private final Map<ConnectionKey, LinkedBlockingDeque<TcpClientConnection>> cache = new ConcurrentHashMap<>();
Expand Down Expand Up @@ -186,7 +187,8 @@ private ClientConnection keepAliveConnection(Http1ClientImpl http1Client,
throw new RuntimeException(e);
}
if (connection == null) {
throw new IllegalStateException("Could not make a new HTTP connection. Maximum number of connections reached.");
throw new IllegalStateException("Could not make a new HTTP connection. "
+ "Maximum number of connections reached.");
} else {
if (LOGGER.isLoggable(DEBUG)) {
LOGGER.log(DEBUG, String.format("[%s] client connection obtained %s",
Expand Down Expand Up @@ -236,7 +238,8 @@ private boolean finishRequest(LinkedBlockingDeque<TcpClientConnection> connectio
if (conn.isConnected()) {
try {
//Connection needs to be marked as idle here.
//This prevents race condition where another thread takes it out of the connection before setting it to idle state.
//This prevents race condition where another thread takes it out of the connection before setting it to
//idle state.
conn.helidonSocket().idle(); // mark it as idle to stay blocked at read for closed conn detection
if (connectionQueue.offer(conn, QUEUE_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS)) {
if (LOGGER.isLoggable(DEBUG)) {
Expand Down Expand Up @@ -427,10 +430,10 @@ private TcpClientConnection checkHostLimit(LimitAlgorithm.Token maxConnectionTok
try {
hostsConnectionLimitLock.lock();
hostLimit = connectionLimitsPerHost.computeIfAbsent(hostKey,
key -> Optional.ofNullable(proxyConfigs.get(proxyIdent))
.flatMap(Http1ProxyLimitConfigBlueprint::connectionPerHostLimit)
.orElse(connectionPerHostLimit)
.copy());
key -> Optional.ofNullable(proxyConfigs.get(proxyIdent))
.flatMap(Http1ProxyLimitConfigBlueprint::connectionPerHostLimit)
.orElse(connectionPerHostLimit)
.copy());
} finally {
hostsConnectionLimitLock.unlock();
}
Expand Down

0 comments on commit eefca6f

Please sign in to comment.