30
30
import java .net .InetSocketAddress ;
31
31
import java .util .Collection ;
32
32
import java .util .Collections ;
33
- import java .util .HashMap ;
34
33
import java .util .HashSet ;
35
34
import java .util .List ;
36
35
import java .util .Map ;
@@ -107,13 +106,6 @@ public class BackendRegistry {
107
106
private Cache <User , Set <String >> restRoleCache ; //
108
107
109
108
private void createCaches () {
110
- Map <AuthCredentials , User > existingUserCache = new HashMap <>();
111
- Map <String , User > existingRestImpersonationCache = new HashMap <>();
112
- Map <User , Set <String >> existingRestRoleCache = new HashMap <>();
113
- if (userCache != null ) {
114
- existingUserCache .putAll (userCache .asMap ());
115
- }
116
-
117
109
userCache = CacheBuilder .newBuilder ()
118
110
.expireAfterWrite (ttlInMin , TimeUnit .MINUTES )
119
111
.removalListener (new RemovalListener <AuthCredentials , User >() {
@@ -124,14 +116,6 @@ public void onRemoval(RemovalNotification<AuthCredentials, User> notification) {
124
116
})
125
117
.build ();
126
118
127
- if (!existingUserCache .isEmpty ()) {
128
- userCache .putAll (existingUserCache );
129
- }
130
-
131
- if (restImpersonationCache != null ) {
132
- existingRestImpersonationCache .putAll (restImpersonationCache .asMap ());
133
- }
134
-
135
119
restImpersonationCache = CacheBuilder .newBuilder ()
136
120
.expireAfterWrite (ttlInMin , TimeUnit .MINUTES )
137
121
.removalListener (new RemovalListener <String , User >() {
@@ -142,14 +126,6 @@ public void onRemoval(RemovalNotification<String, User> notification) {
142
126
})
143
127
.build ();
144
128
145
- if (!existingRestImpersonationCache .isEmpty ()) {
146
- restImpersonationCache .putAll (existingRestImpersonationCache );
147
- }
148
-
149
- if (restRoleCache != null ) {
150
- restRoleCache .putAll (existingRestRoleCache );
151
- }
152
-
153
129
restRoleCache = CacheBuilder .newBuilder ()
154
130
.expireAfterWrite (ttlInMin , TimeUnit .MINUTES )
155
131
.removalListener (new RemovalListener <User , Set <String >>() {
@@ -159,10 +135,6 @@ public void onRemoval(RemovalNotification<User, Set<String>> notification) {
159
135
}
160
136
})
161
137
.build ();
162
-
163
- if (!existingRestRoleCache .isEmpty ()) {
164
- restRoleCache .putAll (existingRestRoleCache );
165
- }
166
138
}
167
139
168
140
public void registerClusterSettingsChangeListener (final ClusterSettings clusterSettings ) {
0 commit comments