You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2019/03/10 09:07:01 UTC

[GitHub] [incubator-skywalking] ascrutae commented on a change in pull request #2292: mysql-8x-plugin and multihost support for mysql5.x

ascrutae commented on a change in pull request #2292: mysql-8x-plugin and multihost support for mysql5.x
URL: https://github.com/apache/incubator-skywalking/pull/2292#discussion_r264029510
 
 

 ##########
 File path: apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/v5/ConnectionCache.java
 ##########
 @@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.jdbc.mysql.v5;
+
+import org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
+import org.apache.skywalking.apm.util.StringUtil;
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * @author: dingshaocheng
+ */
+public class ConnectionCache {
+    private static Map<String, ConnectionInfo> CONNECTIONS_MAP = new ConcurrentHashMap<String, ConnectionInfo>();
+
+    public static ConnectionInfo get(String host, String port) {
+        final String connStr = String.format("%s:%s", host, port);
+        return CONNECTIONS_MAP.get(connStr);
+    }
+
+    public static void save(ConnectionInfo connectionInfo) {
+        Arrays.stream(connectionInfo.getDatabasePeer()
 
 Review comment:
    I'm afraid that it can't work in JDK 1.6, because the agent needs to support JDK 1.6

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services