org.javalid.external.db.core
Class DatabaseState
java.lang.Object
org.javalid.external.db.core.DatabaseState
public class DatabaseState
- extends java.lang.Object
Preserves database state for a thread. Which allows to
cache connections in use. As each thread has its own state
by using a threadlocal it allows us to cache a connection from a
datasource for re-use, preventing unnecessary open/closing of
connections when they are needed.
- Since:
- 1.1
- Version:
- 1.0
- Author:
- M.Reuvers
|
Method Summary |
static java.util.Map<java.lang.String,java.sql.Connection> |
getConnections()
|
static void |
remove()
Clean this thread local. |
static void |
setConnections(java.util.Map<java.lang.String,java.sql.Connection> map)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DatabaseState
public DatabaseState()
setConnections
public static void setConnections(java.util.Map<java.lang.String,java.sql.Connection> map)
getConnections
public static java.util.Map<java.lang.String,java.sql.Connection> getConnections()
remove
public static void remove()
- Clean this thread local. It will have its default value again next time.
- Since:
- 1.1