Interface JDBCDataSource
- All Superinterfaces:
ADEPT2Service
- Author:
- Patrick Schmidt
-
Method Summary
Modifier and TypeMethodDescriptiongetConnection(boolean readOnly) Gets a read-only or writable connection to this data source.getConnection(boolean readOnly, int isolation) Gets a read-only or writable connection to this data source having the designated isolation level.Similar togetConnection(boolean)but the returned connection is intended to be used in a potentially long-livingRemoteIteratorwrapping a result set.voidregisterRemoteIterator(RemoteIterator<?> iterator, long aliveTime) Registers the designated result set remote iterator to drop it after the designated alive time has elapsed.Methods inherited from interface de.aristaflow.adept2.base.service.ADEPT2Service
getLocalUris, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, init, ping, preShutdown, shutdown, start
-
Method Details
-
getConnection
Gets a read-only or writable connection to this data source. This will have the default isolation level of the underlying database system.
Do not forget to close the connection after being done using it! Note that autocommit will be disabled per default.Please be aware that the maximum number of concurrent open connections may be limited, e.g. if connections are pooled and a connection limit is enforced. I.e. this method will block until a connection is available. So when more than one connection is acquired during an operation (concurrently) - within the same method or in another called method - and the number of available connections is exhausted, a deadlock may occur.
- Parameters:
readOnly- Whether the connection should be read-only, thus allowing more concurrency.- Returns:
- A connection to this data source.
- Throws:
SQLException- If there are problems creating the connection, anSQLExceptionwill be thrown.
-
getConnection
Gets a read-only or writable connection to this data source having the designated isolation level. Please take care to only request isolation levels that are supported by the underlying database system.
Do not forget to close the connection after being done using it! Note that autocommit will be disabled per default.Please be aware that the maximum number of concurrent open connections may be limited, e.g. if connections are pooled and a connection limit is enforced. I.e. this method will block until a connection is available. So when more than one connection is acquired during an operation (concurrently) - within the same method or in another called method - and the number of available connections is exhausted, a deadlock may occur.
- Parameters:
readOnly- Whether the connection should be read-only, thus allowing more concurrency.isolation- The isolation level for the connection allowing more or less concurrency.- Returns:
- A connection to this data source.
- Throws:
SQLException- If there are problems creating the connection, this includes requesting an isolation level that is not supported by the underlying database system, anSQLExceptionwill be thrown.
-
getIteratorConnection
Similar togetConnection(boolean)but the returned connection is intended to be used in a potentially long-livingRemoteIteratorwrapping a result set. The connections are read-only and haveConnection.TRANSACTION_READ_COMMITTED.Implementations may manage these connection differently, e.g. in a separate pool, so long-living iterators don't dry out other operations.
- Returns:
- a connection to this data source solely intended for use in
ResultSetRemoteIterators - Throws:
SQLException- if no connection could be acquired
-
registerRemoteIterator
Registers the designated result set remote iterator to drop it after the designated alive time has elapsed. The iterator can be safely dropped beforehand.- Parameters:
iterator- The iterator to drop after its alive time has elapsed.aliveTime- The time in milliseconds the designated iterator can be active without being forced to be dropped.
-