@Override public com.google.common.base.Optional<Boolean> isHealthy() { try { final LdapConnection connection = connectionPool.getConnection(); try { if (connection.isConnected() && connection.isAuthenticated()) { connection.bind(); try { return com.google.common.base.Optional.of(true); } finally { connection.unBind(); } } } finally { connectionPool.releaseConnection(connection); } } catch (LdapException e) { LOG.warn("LdapException caught when checking health", e); exceptionNotifier.notify(String.format("LdapException caught when checking health (%s)", e.getMessage()), e); } return com.google.common.base.Optional.of(false); }
connectionPool.releaseConnection(connection);
@Override public void close() throws IOException { try { pool.releaseConnection(con); } catch (LdapException e) { throw new IOException("LDAP Release Connection error", e); } }
/** * Calls the PoolMgr to close the Admin LDAP connection. * * @param connection handle to ldap connection object. */ public void closeAdminConnection(LdapConnection connection) { try { adminPool.releaseConnection( connection ); } catch ( Exception e ) { throw new RuntimeException( e ); } }
/** * Calls the PoolMgr to close the Log LDAP connection. * * @param connection handle to ldap connection object. */ public void closeLogConnection(LdapConnection connection) { try { logPool.releaseConnection( connection ); } catch ( Exception e ) { throw new RuntimeException( e ); } }
/** * Calls the PoolMgr to close the User LDAP connection. * * @param connection handle to ldap connection object. */ public void closeUserConnection(LdapConnection connection) { try { userPool.releaseConnection( connection ); } catch ( Exception e ) { throw new RuntimeException( e ); } }
/** * Releases a pooled connection back to the pool. * * @param conn the connection to release * @param ldapServer the LDAP server instance, used to obtain the port used * @throws LdapException the exception */ public static void releasePooledAdminConnection( LdapConnection conn, LdapServer ldapServer ) throws LdapException { getAdminPool( ldapServer ).releaseConnection( conn ); }
private void disconnect(@Nullable LdapConnection connection) { try { if (connection != null) { if (adminPool == null) { adminConnectionFactory.destroyObject(connection); } else { adminPool.releaseConnection(connection); } } } catch (Exception e) { log.warn("Error while disconnecting from the ldap server.", e); } }
private void returnLdapConnection( LdapConnection connection ) { if ( connection != null ) { try { connectionPool.releaseConnection( connection ); } catch ( LdapException e ) { throw new LdapRuntimeException( e ); } } }
private void returnLdapConnection( LdapConnection connection ) { if ( connection != null ) { try { connectionPool.releaseConnection( connection ); } catch ( LdapException e ) { throw new LdapRuntimeException( e ); } } }
private void returnLdapConnection( LdapConnection connection ) { if ( connection != null ) { try { connectionPool.releaseConnection( connection ); } catch ( LdapException e ) { throw new LdapRuntimeException( e ); } } }
@Override public com.google.common.base.Optional<Boolean> isHealthy() { try { final LdapConnection connection = connectionPool.getConnection(); try { if (connection.isConnected() && connection.isAuthenticated()) { connection.bind(); try { return com.google.common.base.Optional.of(true); } finally { connection.unBind(); } } } finally { connectionPool.releaseConnection(connection); } } catch (LdapException e) { LOG.warn("LdapException caught when checking health", e); exceptionNotifier.notify(String.format("LdapException caught when checking health (%s)", e.getMessage()), e); } return com.google.common.base.Optional.of(false); }
connectionPool.releaseConnection(connection);