Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Introduction

Beginning with version 0.3.1, Concourse provides a framework for creating pools of cached database connections. Applications that use connection pools may benefit from increased performance since requests can take advantage of previously established connections and therefore avoid the overhead of creating new ones.

Concourse supports both fixed and cached connection pools. A FixedConnectionPool maintains a fixed number of connections for the duration of its use. If all the connections from a fixed pool are taken, then subsequent requests will block until a connection is returned to the pool. On the other hand, a CachedConnectionPool never blocks and will create new connections on demand if the pool does not have any available to service a request.

You can create both kinds of connection pools by calling the appropriately named static factory method in the ConnectionPool class.

Creating a FixedConnectionPool
ConnectionPool connections = ConnectionPool.newFixedConnectionPool(host, port, username, password, poolSize);
Creating a CachedConnectionPool
ConnectionPool connections = ConnectionPool.newCachedConnectionPool(host, port, username, password);
  • No labels