HDFS-17028. RBF: Optimize debug logs of class ConnectionPool and other related class. (#5694). Contributed by farmmamba.

Reviewed-by: Inigo Goiri <inigoiri@apache.org>
Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
This commit is contained in:
hfutatzhanghb 2023-06-05 17:04:46 +08:00 committed by GitHub
parent 1d0c9ab433
commit 2243cfd225
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

View File

@ -150,8 +150,8 @@ public class ConnectionContext {
// this is an erroneous case, but we have to close the connection // this is an erroneous case, but we have to close the connection
// anyway since there will be connection leak if we don't do so // anyway since there will be connection leak if we don't do so
// the connection has been moved out of the pool // the connection has been moved out of the pool
LOG.error("Active connection with {} handlers will be closed", LOG.error("Active connection with {} handlers will be closed, ConnectionContext is {}",
this.numThreads); this.numThreads, this);
} }
this.closed = true; this.closed = true;
Object proxy = this.client.getProxy(); Object proxy = this.client.getProxy();
@ -170,7 +170,10 @@ public class ConnectionContext {
Class<?> clazz = proxy.getClass(); Class<?> clazz = proxy.getClass();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(clazz.getSimpleName()) sb.append("hashcode:")
.append(hashCode())
.append(" ")
.append(clazz.getSimpleName())
.append("@") .append("@")
.append(addr) .append(addr)
.append("x") .append("x")

View File

@ -482,7 +482,7 @@ public class ConnectionManager {
pool.getMaxSize(), pool); pool.getMaxSize(), pool);
} }
} catch (IOException e) { } catch (IOException e) {
LOG.error("Cannot create a new connection", e); LOG.error("Cannot create a new connection for {} {}", pool, e);
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
LOG.error("The connection creator was interrupted"); LOG.error("The connection creator was interrupted");

View File

@ -286,8 +286,8 @@ public class ConnectionPool {
} }
this.connections = tmpConnections; this.connections = tmpConnections;
} }
LOG.debug("Expected to remove {} connection and actually removed {} connections", LOG.debug("Expected to remove {} connection and actually removed {} connections "
num, removed.size()); + "for connectionPool: {}", num, removed.size(), connectionPoolId);
return removed; return removed;
} }