use of org.codelibs.fess.exception.LdapOperationException in project fess by codelibs.
the class LdapManager method getDirContext.
protected DirContextHolder getDirContext(final Supplier<Hashtable<String, String>> envSupplier) {
DirContextHolder holder = contextLocal.get();
if (holder == null) {
final Hashtable<String, String> env = envSupplier.get();
try {
holder = new DirContextHolder(new InitialDirContext(env));
contextLocal.set(holder);
return holder;
} catch (final NamingException e) {
throw new LdapOperationException("Failed to create DirContext.", e);
}
} else {
holder.inc();
return holder;
}
}
Aggregations