diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/cluster/ClusterTokenClient.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/cluster/ClusterTokenClient.java deleted file mode 100644 index 6a230c07..00000000 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/cluster/ClusterTokenClient.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.csp.sentinel.cluster; - -/** - * Token client interface for distributed flow control. - * - * @author Eric Zhao - * @since 1.4.0 - */ -public interface ClusterTokenClient extends TokenService { - - /** - * Get descriptor of current token server. - * - * @return current token server - */ - TokenServerDescriptor currentServer(); -} \ No newline at end of file diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/cluster/TokenClientProvider.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/cluster/TokenClientProvider.java deleted file mode 100644 index 592046c9..00000000 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/cluster/TokenClientProvider.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.csp.sentinel.cluster; - -import java.util.ArrayList; -import java.util.List; -import java.util.ServiceLoader; - -import com.alibaba.csp.sentinel.log.RecordLog; - -/** - * Provider for a universal {@link ClusterTokenClient} instance. - * - * @author Eric Zhao - * @since 1.4.0 - */ -public final class TokenClientProvider { - - private static ClusterTokenClient client = null; - - private static final ServiceLoader LOADER = ServiceLoader.load(ClusterTokenClient.class); - - static { - // Not strictly thread-safe, but it's OK since it will be resolved only once. - resolveTokenClientInstance(); - } - - public static ClusterTokenClient getClient() { - return client; - } - - private static void resolveTokenClientInstance() { - List clients = new ArrayList(); - for (ClusterTokenClient client : LOADER) { - clients.add(client); - } - - if (!clients.isEmpty()) { - // Get first. - client = clients.get(0); - RecordLog.info("[TokenClientProvider] Token client resolved: " + client.getClass().getCanonicalName()); - } else { - RecordLog.warn("[TokenClientProvider] No existing token client, resolve failed"); - } - } - - private TokenClientProvider() {} -}