Interface JDBCDataSource
-
- All Superinterfaces:
ADEPT2Service
public interface JDBCDataSource extends ADEPT2Service
Represents a JDBC data source. It only provides a method to retrieve a connection to this data source.- Author:
- Patrick Schmidt
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ExtendedConnection
getConnection(boolean readOnly)
Gets a read-only or writable connection to this data source.ExtendedConnection
getConnection(boolean readOnly, int isolation)
Gets a read-only or writable connection to this data source having the designated isolation level.ExtendedConnection
getIteratorConnection()
Similar togetConnection(boolean)
but the returned connection is intended to be used in a potentially long-livingRemoteIterator
wrapping a result set.void
registerRemoteIterator(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 Detail
-
getConnection
ExtendedConnection getConnection(boolean readOnly) throws SQLException
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, anSQLException
will be thrown.
-
getConnection
ExtendedConnection getConnection(boolean readOnly, int isolation) throws SQLException
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, anSQLException
will be thrown.
-
getIteratorConnection
ExtendedConnection getIteratorConnection() throws SQLException
Similar togetConnection(boolean)
but the returned connection is intended to be used in a potentially long-livingRemoteIterator
wrapping 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
ResultSetRemoteIterator
s - Throws:
SQLException
- if no connection could be acquired
-
registerRemoteIterator
void registerRemoteIterator(RemoteIterator<?> iterator, long aliveTime)
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.
-
-