Package org.forgerock.json.resource
Interface ConnectionFactory
- 
- All Superinterfaces:
 AutoCloseable,Closeable
public interface ConnectionFactory extends Closeable
A connection factory provides an interface for obtaining a connection to a JSON resource provider. Connection factories can be used to wrap other connection factories in order to provide enhanced capabilities in a manner which is transparent to the application. For example:- Connection pooling
 - Load balancing
 - Keep alive
 - Logging connections
 - Read-only connections
 
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Releases any resources associated with this connection factory.ConnectiongetConnection()Returns a connection to the JSON resource provider associated with this connection factory.Promise<Connection,ResourceException>getConnectionAsync()Asynchronously obtains a connection to the JSON resource provider associated with this connection factory. 
 - 
 
- 
- 
Method Detail
- 
close
void close()
Releases any resources associated with this connection factory. Depending on the implementation a factory may:- do nothing
 - close underlying connection factories (e.g. load-balancers)
 - close pooled connections (e.g. connection pools)
 - shutdown IO event service and related thread pools (e.g. Grizzly).
 
closeon a connection factory which is already closed has no effect.Applications should avoid closing connection factories while there are remaining active connections in use or connection attempts in progress.
- Specified by:
 closein interfaceAutoCloseable- Specified by:
 closein interfaceCloseable- See Also:
 Resources.uncloseable(ConnectionFactory)
 
- 
getConnection
Connection getConnection() throws ResourceException
Returns a connection to the JSON resource provider associated with this connection factory. The connection returned by this method can be used immediately.- Returns:
 - A connection to the JSON resource provider associated with this connection factory.
 - Throws:
 ResourceException- If the connection request failed for some reason.
 
- 
getConnectionAsync
Promise<Connection,ResourceException> getConnectionAsync()
Asynchronously obtains a connection to the JSON resource provider associated with this connection factory. The returnedFutureResultcan be used to retrieve the completed connection.- Returns:
 - A future which can be used to retrieve the connection.
 
 
 - 
 
 -