lpcy commented on pull request #18:
URL: https://github.com/apache/skywalking-java/pull/18#issuecomment-912238428
> > The problem is, if I use multi-db-instance with same host:port in one
application, the code for putting connection info in cache will overwrite
previous data due to duplicate host:port key, the previous db instance info
will be lost, and also cannot get correct connection info from cache after that.
>
> This connection create interceptor is going to be called repeatedly for
different instances? Could you put some reference of MySQL driver's source
codes about this? Is it a loop call or something?
```java
class ConnectionCache:
public static void save(ConnectionInfo connectionInfo) {
for (String conn :
connectionInfo.getDatabasePeer().split(CONNECTION_SPLIT_STR)) {
if (!StringUtil.isEmpty(conn)) {
CONNECTIONS_MAP.putIfAbsent(conn, connectionInfo);
}
}
}
If the connections are :
A: jdbc:mysql://hostA:portA/databaseA?propertyName1=propertyValue1
B : jdbc:mysql://hostA:portA/databaseB?propertyName1=propertyValue1
the connection info A will be covered by B and be lost due to duplicate key
"conn".
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]