@@ -548,7 +548,7 @@ public void run() {
548548 if (clusterRefs .get (cluster ).refCount .get () != 0 ) {
549549 throw new AssertionError ();
550550 }
551- clusterRefs .remove (cluster ). close () ;
551+ clusterRefs .remove (cluster );
552552 if (resolveState .lastConfigOrStatus .hasValue ()) {
553553 updateResolutionResult (resolveState .lastConfigOrStatus .getValue ());
554554 } else {
@@ -793,13 +793,9 @@ private void updateRoutes(
793793 clusterRefs .get (cluster ).refCount .incrementAndGet ();
794794 } else {
795795 if (clusterNameMap .containsKey (cluster )) {
796- assert cluster .startsWith ("cluster:" );
797- XdsConfig .Subscription subscription =
798- xdsDependencyManager .subscribeToCluster (cluster .substring ("cluster:" .length ()));
799796 clusterRefs .put (
800797 cluster ,
801- ClusterRefState .forCluster (
802- new AtomicInteger (1 ), clusterNameMap .get (cluster ), subscription ));
798+ ClusterRefState .forCluster (new AtomicInteger (1 ), clusterNameMap .get (cluster )));
803799 }
804800 if (rlsPluginConfigMap .containsKey (cluster )) {
805801 clusterRefs .put (
@@ -830,7 +826,7 @@ private void updateRoutes(
830826 for (String cluster : deletedClusters ) {
831827 int count = clusterRefs .get (cluster ).refCount .decrementAndGet ();
832828 if (count == 0 ) {
833- clusterRefs .remove (cluster ). close () ;
829+ clusterRefs .remove (cluster );
834830 shouldUpdateResult = true ;
835831 }
836832 }
@@ -883,7 +879,7 @@ private void cleanUpRoutes(Status error) {
883879 for (String cluster : existingClusters ) {
884880 int count = clusterRefs .get (cluster ).refCount .decrementAndGet ();
885881 if (count == 0 ) {
886- clusterRefs .remove (cluster ). close () ;
882+ clusterRefs .remove (cluster );
887883 }
888884 }
889885 existingClusters = null ;
@@ -969,18 +965,15 @@ private static class ClusterRefState {
969965 final String traditionalCluster ;
970966 @ Nullable
971967 final RlsPluginConfig rlsPluginConfig ;
972- @ Nullable
973- final XdsConfig .Subscription subscription ;
974968
975969 private ClusterRefState (
976970 AtomicInteger refCount , @ Nullable String traditionalCluster ,
977- @ Nullable RlsPluginConfig rlsPluginConfig , @ Nullable XdsConfig . Subscription subscription ) {
971+ @ Nullable RlsPluginConfig rlsPluginConfig ) {
978972 this .refCount = refCount ;
979973 checkArgument (traditionalCluster == null ^ rlsPluginConfig == null ,
980974 "There must be exactly one non-null value in traditionalCluster and pluginConfig" );
981975 this .traditionalCluster = traditionalCluster ;
982976 this .rlsPluginConfig = rlsPluginConfig ;
983- this .subscription = subscription ;
984977 }
985978
986979 private Map <String , ?> toLbPolicy () {
@@ -1000,21 +993,12 @@ private ClusterRefState(
1000993 }
1001994 }
1002995
1003- private void close () {
1004- if (subscription != null ) {
1005- subscription .close ();
1006- }
1007- }
1008-
1009- static ClusterRefState forCluster (
1010- AtomicInteger refCount , String name , XdsConfig .Subscription subscription ) {
1011- return new ClusterRefState (refCount , name , null , checkNotNull (subscription , "subscription" ));
996+ static ClusterRefState forCluster (AtomicInteger refCount , String name ) {
997+ return new ClusterRefState (refCount , name , null );
1012998 }
1013999
1014- static ClusterRefState forRlsPlugin (
1015- AtomicInteger refCount ,
1016- RlsPluginConfig rlsPluginConfig ) {
1017- return new ClusterRefState (refCount , null , rlsPluginConfig , null );
1000+ static ClusterRefState forRlsPlugin (AtomicInteger refCount , RlsPluginConfig rlsPluginConfig ) {
1001+ return new ClusterRefState (refCount , null , rlsPluginConfig );
10181002 }
10191003 }
10201004}
0 commit comments