Merge pull request #4282 from cargosoft/KEYCLOAK-5131
KEYCLOAK-5131 ProviderFactory::postInit not called with hot deployment
This commit is contained in:
commit
1e059e3fa3
1 changed files with 5 additions and 0 deletions
|
@ -112,6 +112,7 @@ public class DefaultKeycloakSessionFactory implements KeycloakSessionFactory, Pr
|
||||||
public void deploy(ProviderManager pm) {
|
public void deploy(ProviderManager pm) {
|
||||||
Map<Class<? extends Provider>, Map<String, ProviderFactory>> copy = getFactoriesCopy();
|
Map<Class<? extends Provider>, Map<String, ProviderFactory>> copy = getFactoriesCopy();
|
||||||
Map<Class<? extends Provider>, Map<String, ProviderFactory>> newFactories = loadFactories(pm);
|
Map<Class<? extends Provider>, Map<String, ProviderFactory>> newFactories = loadFactories(pm);
|
||||||
|
List<ProviderFactory> deployed = new LinkedList<>();
|
||||||
List<ProviderFactory> undeployed = new LinkedList<>();
|
List<ProviderFactory> undeployed = new LinkedList<>();
|
||||||
|
|
||||||
for (Map.Entry<Class<? extends Provider>, Map<String, ProviderFactory>> entry : newFactories.entrySet()) {
|
for (Map.Entry<Class<? extends Provider>, Map<String, ProviderFactory>> entry : newFactories.entrySet()) {
|
||||||
|
@ -120,6 +121,7 @@ public class DefaultKeycloakSessionFactory implements KeycloakSessionFactory, Pr
|
||||||
copy.put(entry.getKey(), entry.getValue());
|
copy.put(entry.getKey(), entry.getValue());
|
||||||
} else {
|
} else {
|
||||||
for (ProviderFactory f : entry.getValue().values()) {
|
for (ProviderFactory f : entry.getValue().values()) {
|
||||||
|
deployed.add(f);
|
||||||
ProviderFactory old = current.remove(f.getId());
|
ProviderFactory old = current.remove(f.getId());
|
||||||
if (old != null) undeployed.add(old);
|
if (old != null) undeployed.add(old);
|
||||||
}
|
}
|
||||||
|
@ -131,6 +133,9 @@ public class DefaultKeycloakSessionFactory implements KeycloakSessionFactory, Pr
|
||||||
for (ProviderFactory factory : undeployed) {
|
for (ProviderFactory factory : undeployed) {
|
||||||
factory.close();
|
factory.close();
|
||||||
}
|
}
|
||||||
|
for (ProviderFactory factory : deployed) {
|
||||||
|
factory.postInit(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue