Class PooledQldbDriver
Represents a factory for accessing pooled sessions to a specific ledger within QLDB. This class or QldbDriver should be the main entry points to any interaction with QLDB. GetSession() will create a Amazon.QLDB.Driver.PooledQldbSession to the specified ledger within QLDB as a communication channel. Any acquired sessions must be cleaned up with Amazon.QLDB.Driver.PooledQldbSession.Dispose when they are no longer needed in order to return the session to the pool. If this is not done, this driver may become unusable if the pool limit is exceeded.
This factory pools sessions and attempts to return unused but available sessions when getting new sessions. The advantage to using this over the non-pooling driver is that the underlying connection that sessions use to communicate with QLDB can be recycled, minimizing resource usage by preventing unnecessary connections and reducing latency by not making unnecessary requests to start new connections and end reusable, existing, ones.
The pool does not remove stale sessions until a new session is retrieved. The default pool size is the maximum
amount of connections the session client allows set in the
Inheritance
Namespace: Amazon.QLDB.Driver
Assembly: Amazon.QLDB.Driver.dll
Syntax
public class PooledQldbDriver : object, IQldbDriver, IDisposable
Methods
| Improve this Doc View SourceBuilder()
Retrieve a builder object for creating a PooledQldbDriver.
Declaration
public static PooledQldbDriver.PooledQldbDriverBuilder Builder()
Returns
Type | Description |
---|---|
PooledQldbDriver.PooledQldbDriverBuilder | The builder object for creating a PooledQldbDriver. |
Dispose()
Disposes of the driver.
Declaration
public void Dispose()
GetSession()
Get a IQldbSession object.
This will attempt to retrieve an active existing session, or it will start a new session with QLDB unless the
number of allocated sessions has exceeded the pool size limit. If so, then it will continue trying to retrieve an
active existing session until the timeout is reached, throwing a
Declaration
public IQldbSession GetSession()
Returns
Type | Description |
---|---|
IQldbSession | The IQldbSession object. |