use of org.jboss.weld.util.reflection.ParameterizedTypeImpl in project oxAuth by GluuFederation.
the class AppInitializer method recreateLdapAuthEntryManagers.
public void recreateLdapAuthEntryManagers(List<GluuLdapConfiguration> newLdapAuthConfigs) {
// Get existing application scoped instance
List<LdapEntryManager> oldLdapAuthEntryManagers = CdiUtil.getContextBean(beanManager, new ParameterizedTypeImpl(List.class, LdapEntryManager.class), LDAP_AUTH_ENTRY_MANAGER_NAME);
// Recreate components
createAuthConnectionProviders(newLdapAuthConfigs);
// Close existing connections
closeLdapAuthEntryManagers(oldLdapAuthEntryManagers);
// Destroy old Ldap auth entry managers
for (LdapEntryManager oldLdapAuthEntryManager : oldLdapAuthEntryManagers) {
log.debug("Attempting to destroy {}: {}", LDAP_AUTH_ENTRY_MANAGER_NAME, oldLdapAuthEntryManager);
oldLdapAuthEntryManager.destroy();
log.debug("Destroyed {}: {}", LDAP_AUTH_ENTRY_MANAGER_NAME, oldLdapAuthEntryManager);
}
// Force to create new bean
List<LdapEntryManager> ldapAuthEntryManagers = ldapAuthEntryManagerInstance.get();
ldapAuthEntryManagerInstance.destroy(ldapAuthEntryManagers);
log.info("Recreated instance {}: {}", LDAP_AUTH_ENTRY_MANAGER_NAME, ldapAuthEntryManagers);
}
Aggregations