@@ -0,0 +1,1914 @@
+/*%0A * Copyright 2016-2018 shardingsphere.io.%0A * %3Cp%3E%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A * %3C/p%3E%0A */%0A%0Apackage io.shardingsphere.proxy.backend.common;%0A%0Aimport javax.sql.DataSource;%0Aimport java.sql.Connection;%0Aimport java.util.LinkedHashMap;%0Aimport java.util.Map;%0A%0A/**%0A * Hold the connection when proxyMode is CONNECTION_STRICTLY.%0A *%0A * @author zhaojun%0A */%0Apublic class ProxyConnectionHolder %7B%0A    %0A    private static final ThreadLocal%3CMap%3CDataSource, Connection%3E%3E RESOURCE = new ThreadLocal%3CMap%3CDataSource, Connection%3E%3E() %7B%0A        @Override%0A        protected Map%3CDataSource, Connection%3E initialValue() %7B%0A            return new LinkedHashMap%3C%3E();%0A        %7D%0A    %7D;%0A    %0A    /**%0A     * Set connection associate with datasource into Thread.%0A     *%0A     * @param dataSource DataSource%0A     * @param connection Connection%0A     */%0A    public static void setConnection(final DataSource dataSource, final Connection connection) %7B%0A        RESOURCE.get().put(dataSource, connection);%0A    %7D%0A    %0A    /**%0A     * Get connection of current thread datasource.%0A     *%0A     * @param dataSource Datasource%0A     * @return Connection%0A     */%0A    public static Connection getConnection(final DataSource dataSource) %7B%0A        return RESOURCE.get().get(dataSource);%0A    %7D%0A    %0A    /**%0A     * Clear Connection resource for current thread-local.%0A     */%0A    public static void clear() %7B%0A        RESOURCE.remove();%0A    %7D%0A%7D%0A

Add ProxyConnectionHolder for CONNECTION-STRICTLY mode.