Package lu.kbra.pclib.db.connector
Class ThreadLocalDatabaseConnector
java.lang.Object
lu.kbra.pclib.db.connector.AbstractDatabaseConnector
lu.kbra.pclib.db.connector.ThreadLocalDatabaseConnector
- All Implemented Interfaces:
Cloneable,DatabaseConnector
- Direct Known Subclasses:
MySQLDatabaseConnector,PostgreSQLDatabaseConnector,SQLiteDatabaseConnector
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classNested classes/interfaces inherited from class lu.kbra.pclib.db.connector.AbstractDatabaseConnector
AbstractDatabaseConnector.CachedConnection, AbstractDatabaseConnector.ConnectionCachingStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Set<AbstractDatabaseConnector.CachedConnection> protected final AtomicLongprotected final ThreadLocal<AbstractDatabaseConnector.CachedConnection> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal Connectionconnect()booleankeepAlive(int timeoutSeconds) final voidreset()use()Methods inherited from class lu.kbra.pclib.db.connector.AbstractDatabaseConnector
cloneMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface lu.kbra.pclib.db.connector.impl.DatabaseConnector
createConnection, getDatabase, getProtocol, getURI, preDelete, setDatabase
-
Field Details
-
threadConnection
-
connections
-
generation
-
-
Constructor Details
-
ThreadLocalDatabaseConnector
public ThreadLocalDatabaseConnector()
-
-
Method Details
-
connect
- Throws:
DBException
-
keepAlive
public boolean keepAlive(int timeoutSeconds) - Parameters:
timeoutSeconds-- Returns:
- false if the connection was still alive or isn't created.
true if the connection needed to be reset
-
reset
- Throws:
DBException
-
use
- Throws:
DBException
-
getConnectionCachingStrategy
- Specified by:
getConnectionCachingStrategyin classAbstractDatabaseConnector
-