| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2012 ForgeRock AS. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | | |
| | | import java.io.Closeable; |
| | | |
| | | /** |
| | | * A connection factory provides an interface for obtaining a connection to a |
| | | * Directory Server. Connection factories can be used to wrap other connection |
| | |
| | | * should aim to close connections as soon as possible in order to avoid |
| | | * resource contention. |
| | | */ |
| | | public interface ConnectionFactory { |
| | | public interface ConnectionFactory extends Closeable { |
| | | |
| | | /** |
| | | * Releases any resources associated with this connection factory. Depending |
| | | * on the implementation a factory may: |
| | | * <ul> |
| | | * <li>do nothing |
| | | * <li>close underlying connection factories (e.g. load-balancers) |
| | | * <li>close pooled connections (e.g. connection pools) |
| | | * <li>shutdown IO event service and related thread pools (e.g. Grizzly). |
| | | * </ul> |
| | | * Calling {@code close} on a connection factory which is already closed has |
| | | * no effect. |
| | | * <p> |
| | | * Applications should avoid closing connection factories while there are |
| | | * remaining active connections in use or connection attempts in progress. |
| | | * |
| | | * @see Connections#uncloseable(ConnectionFactory) |
| | | */ |
| | | @Override |
| | | public void close(); |
| | | |
| | | /** |
| | | * Asynchronously obtains a connection to the Directory Server associated |
| | | * with this connection factory. The returned {@code FutureResult} can be |