Skip to content

Commit

Permalink
Remove FQDN from PoolKey
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzawa-san committed Mar 19, 2023
1 parent b9135b7 commit ec15e83
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2022 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2018-2023 VMware, Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -240,7 +240,7 @@ public final void disposeWhen(SocketAddress address) {
toDispose.forEach(e -> {
if (channelPools.remove(e.getKey(), e.getValue())) {
if (log.isDebugEnabled()) {
log.debug("ConnectionProvider[name={}]: Disposing pool for [{}]", name, e.getKey().fqdn);
log.debug("ConnectionProvider[name={}]: Disposing pool for [{}]", name, e.getKey().holder);
}
String id = e.getKey().hashCode() + "";
PoolFactory<T> poolFactory = poolFactory(address);
Expand Down Expand Up @@ -364,7 +364,7 @@ final void disposeInactivePoolsInBackground() {
toDispose.forEach(e -> {
if (channelPools.remove(e.getKey(), e.getValue())) {
if (log.isDebugEnabled()) {
log.debug("ConnectionProvider[name={}]: Disposing inactive pool for [{}]", name, e.getKey().fqdn);
log.debug("ConnectionProvider[name={}]: Disposing inactive pool for [{}]", name, e.getKey().holder);
}
e.getValue().dispose();
}
Expand Down Expand Up @@ -628,12 +628,10 @@ public long allocationTimestamp() {
}

static final class PoolKey {
final String fqdn;
final SocketAddress holder;
final int pipelineKey;

PoolKey(SocketAddress holder, int pipelineKey) {
this.fqdn = holder.toString();
this.holder = holder;
this.pipelineKey = pipelineKey;
}
Expand All @@ -647,14 +645,16 @@ public boolean equals(Object o) {
return false;
}
PoolKey poolKey = (PoolKey) o;
return Objects.equals(fqdn, poolKey.fqdn) &&
Objects.equals(holder, poolKey.holder) &&
return Objects.equals(holder, poolKey.holder) &&
pipelineKey == poolKey.pipelineKey;
}

@Override
public int hashCode() {
return Objects.hash(fqdn, holder, pipelineKey);
int result = 1;
result = 31 * result + Objects.hashCode(holder);
result = 31 * result + pipelineKey;
return result;
}
}
}

0 comments on commit ec15e83

Please sign in to comment.