public class ConnectionManager extends Object
Connection connection = connectionManager.getConnection(...);
try {
...
} finally {
connection.release();
}
Without keep-alive replace Connection.release()
by Connection.close()
.
Note that you should call Connection.release()
exactly once, or alternatively
Connection.close()
at least once.Constructor and Description |
---|
ConnectionManager() |
Modifier and Type | Method and Description |
---|---|
Connection |
getConnection(InetAddress host,
int port,
String localHost,
SSLContext sslContext) |
void |
releaseConnection(Connection connection) |
void |
shutdownWhenDone() |
public Connection getConnection(InetAddress host, int port, String localHost, SSLContext sslContext) throws UnknownHostException, IOException
UnknownHostException
IOException
public void releaseConnection(Connection connection)
public void shutdownWhenDone()
Copyright © 2012. All Rights Reserved.