Closed
Description
ConcurrentReferenceHashMap
is a cache-style map that uses weak references.
Since InMemoryReactiveClientRegistrationRepository
is intended to be persistent, it should instead use ConcurrentHashMap
.
The change to be made is in the InMemoryReactiveClientRegistrationRepository
constructor that instantiates a ConcurrentReferenceHashMap
:
Assert.notEmpty(registrations, "registrations cannot be empty");
this.clientIdToClientRegistration = new ConcurrentReferenceHashMap<>(); // <-- this line
for (ClientRegistration registration : registrations) {
Assert.notNull(registration, "registrations cannot contain null values");
this.clientIdToClientRegistration.put(registration.getRegistrationId(), registration);
}
should instead be
Assert.notEmpty(registrations, "registrations cannot be empty");
this.clientIdToClientRegistration = new ConcurrentHashMap<>(); // <-- this line
for (ClientRegistration registration : registrations) {
Assert.notNull(registration, "registrations cannot contain null values");
this.clientIdToClientRegistration.put(registration.getRegistrationId(), registration);
}
This ticket should also be backported to 5.1.x.