public static void releaseDefunct(LDAPConnection connection) { if (connection != null && connection.getConnectionPool() != null) connection.getConnectionPool().releaseDefunctConnection(connection); }
public static void releaseDefunct(LDAPConnection connection) { if (connection != null && connection.getConnectionPool() != null) connection.getConnectionPool().releaseDefunctConnection(connection); }
/** * Unbinds from the server and closes the connection, optionally including * the provided set of controls in the unbind request. * <BR><BR> * If this method is invoked while any operations are in progress on this * connection, then the directory server may or may not abort processing for * those operations, depending on the type of operation and how far along the * server has already gotten while processing that operation. It is * recommended that all active operations be abandoned, canceled, or allowed * to complete before attempting to close an active connection. * * @param controls The set of controls to include in the unbind request. It * may be {@code null} if there are not to be any controls * sent in the unbind request. */ public void close(final Control[] controls) { closeRequested = true; setDisconnectInfo(DisconnectType.UNBIND, null, null); if (connectionPool == null) { terminate(controls); } else { connectionPool.releaseDefunctConnection(this); } }
/** * Unbinds from the server and closes the connection, optionally including * the provided set of controls in the unbind request. * <BR><BR> * If this method is invoked while any operations are in progress on this * connection, then the directory server may or may not abort processing for * those operations, depending on the type of operation and how far along the * server has already gotten while processing that operation. It is * recommended that all active operations be abandoned, canceled, or allowed * to complete before attempting to close an active connection. * * @param controls The set of controls to include in the unbind request. It * may be {@code null} if there are not to be any controls * sent in the unbind request. */ @ThreadSafety(level=ThreadSafetyLevel.METHOD_NOT_THREADSAFE) public void close(final Control[] controls) { closeRequested = true; setDisconnectInfo(DisconnectType.UNBIND, null, null); if (connectionPool == null) { terminate(controls); } else { connectionPool.releaseDefunctConnection(this); } }
/** * Releases the provided connection back to the pool after an exception has * been encountered while processing an operation on that connection. The * connection pool health check instance associated with this pool will be * used to determine whether the provided connection is still valid and will * either release it back for use in processing other operations on the * connection or will terminate the connection and create a new one to take * its place. * * @param connection The connection to be evaluated and released back to the * pool or replaced with a new connection. * @param exception The exception caught while processing an operation on * the connection. */ public final void releaseConnectionAfterException( final LDAPConnection connection, final LDAPException exception) { final LDAPConnectionPoolHealthCheck healthCheck = getHealthCheck(); try { healthCheck.ensureConnectionValidAfterException(connection, exception); releaseConnection(connection); } catch (LDAPException le) { debugException(le); releaseDefunctConnection(connection); } }
/** * Releases the provided connection back to the pool after an exception has * been encountered while processing an operation on that connection. The * connection pool health check instance associated with this pool will be * used to determine whether the provided connection is still valid and will * either release it back for use in processing other operations on the * connection or will terminate the connection and create a new one to take * its place. * * @param connection The connection to be evaluated and released back to the * pool or replaced with a new connection. * @param exception The exception caught while processing an operation on * the connection. */ public final void releaseConnectionAfterException( final LDAPConnection connection, final LDAPException exception) { final LDAPConnectionPoolHealthCheck healthCheck = getHealthCheck(); try { healthCheck.ensureConnectionValidAfterException(connection, exception); releaseConnection(connection); } catch (LDAPException le) { debugException(le); releaseDefunctConnection(connection); } }
/** * Handles the provided {@code Throwable} object by ensuring that the provided * connection is released to the pool and throwing an appropriate * {@code LDAPException} object. * * @param t The {@code Throwable} object that was caught. * @param conn The connection to be released to the pool. * * @throws LDAPException To indicate that a problem occurred during LDAP * processing. */ void throwLDAPException(final Throwable t, final LDAPConnection conn) throws LDAPException { debugException(t); if (t instanceof LDAPException) { final LDAPException le = (LDAPException) t; releaseConnectionAfterException(conn, le); throw le; } else { releaseDefunctConnection(conn); throw new LDAPException(ResultCode.LOCAL_ERROR, ERR_POOL_OP_EXCEPTION.get(getExceptionMessage(t)), t); } }
/** * Handles the provided {@code Throwable} object by ensuring that the provided * connection is released to the pool and throwing an appropriate * {@code LDAPException} object. * * @param t The {@code Throwable} object that was caught. * @param conn The connection to be released to the pool. * * @throws LDAPException To indicate that a problem occurred during LDAP * processing. */ void throwLDAPException(final Throwable t, final LDAPConnection conn) throws LDAPException { debugException(t); if (t instanceof LDAPException) { final LDAPException le = (LDAPException) t; releaseConnectionAfterException(conn, le); throw le; } else { releaseDefunctConnection(conn); throw new LDAPException(ResultCode.LOCAL_ERROR, ERR_POOL_OP_EXCEPTION.get(getExceptionMessage(t)), t); } }
releaseDefunctConnection(conn); throw new LDAPSearchException(ResultCode.LOCAL_ERROR, ERR_POOL_OP_EXCEPTION.get(getExceptionMessage(t)), t);
releaseDefunctConnection(conn); throw new LDAPSearchException(ResultCode.LOCAL_ERROR, ERR_POOL_OP_EXCEPTION.get(getExceptionMessage(t)), t);