org.javalid.external.db.core
Class DatabaseState

java.lang.Object
  extended by 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

Constructor Summary
DatabaseState()
           
 
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
 

Constructor Detail

DatabaseState

public DatabaseState()
Method Detail

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