Changes between Initial Version and Version 1 of DatabaseConnectionsForThreadsAndNewPool


Ignore:
Timestamp:
Jan 31, 2011, 11:12:56 PM (13 years ago)
Author:
simonp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DatabaseConnectionsForThreadsAndNewPool

    v1 v1  
     1= Database Connections for Threads and Commons Database Connection Pool =
     2
     3|| '''Date''' || 2011/02/01 ||
     4|| '''Contact(s)''' || Simon Pigot, Francois Prunayre, Mathieu Coudert ||
     5|| '''Last edited''' || 2011/02/01 ||
     6|| '''Status''' || in progress ||
     7|| '''Assigned to release''' || 2.7.0 ||
     8|| '''Resources''' || Available ||
     9
     10== Overview ==
     11
     12Database connections (jeeves/src/main/java/jeeves/resources/dbms/Dbms.java) in Jeeves are handled by a ResourceManager (jeeves/src/main/java/jeeves/server/resources/ResourceManager.java) and pooled by a ResourceProvider (jeeves/src/main/java/jeeves/resources/dbms/DbmsPool.java).
     13
     14A jeeves service that needs a database connection will typically open one using a call like:
     15
     16Dbms dbms = (Dbms) context.getResourceManager().open(Geonet.Res.MAIN_DB);
     17
     18This can be done any number of times by methods called by the service. As each Dbms object is opened the ResourceManager keeps a reference to it in an internal hashtable.
     19
     20If the service completes without exception, all database connections are closed by Jeeves using context.getResourceManager().close() or if there is an exception raised context.getResourceManager().abort()
     21
     22However there is a need for threads that want a database connection to obtain a connection and hold that connection open even though the service that started the thread may have closed.
     23
     24This proposal will add the following calls to the ResourceManager to support threads that need a database connection in GeoNetwork/Jeeves:
     25
     26* openDirect(): essentially does the same as open but does not keep a reference to the Dbms resource in the ResourceManager hashtable
     27* close(String name, Object resource): closes the resource from the named resource provider
     28
     29In addition the proposal will add:
     30
     31* a new ResourceProvider to pool database connections which uses the Apache Commons Database Connection Pool (ApacheDBCP.java) - this is a slightly more sophisticated approach to database connection pooling than the homegrown Jeeves DatabasePool.java code
     32* threads to support safe background database operations for: increasing popularity of metadata (eg. in metadata show), logging search statistics, indexing metadata records after the servlet has started and potentially many other operations that can be put into the background as threads to not slow down critical operations such as search
     33* a configurable ThreadPool that all code can access through the GeonetContext which can be used to manage thread operations eg. place limits on the number of threads that can be executed at any one time   
     34
     35=== Proposal Type ===
     36 * '''Type''': Core Change and change to coding procedures ie. use new ResourceManager calls for threads that need database connections, use ThreadPool to execute threads
     37 * '''App''': !GeoNetwork
     38 * '''Module''': Kernel and services
     39
     40=== Links ===
     41 * '''Documents''':
     42 * '''Email discussions''':
     43 * '''Other wiki discussions''':
     44
     45=== Voting History ===
     46 * Not proposed for voting yet.
     47
     48----
     49
     50== Motivations ==
     51 * provide safe database connections for threads to use
     52 * improve database connection pooling code
     53 * manage threads executed by GeoNetwork
     54
     55== Proposal ==
     56
     57Overview gives details of proposal :-)
     58
     59=== Backwards Compatibility Issues ===
     60
     61New Database connection pool (ApacheDBCP.java) can be configured in config.xml, old database pool remains if someone wants to continue to use that (DbmsPool.java).
     62
     63=== New libraries added ===
     64
     65commons-dbcp - version 1.3
     66commons-pool - version 1.5.5
     67
     68== Risks ==
     69
     70Everything has a certain amount of risk.....
     71
     72== Participants ==
     73 * Simon Pigot, Francois-Xavier Prunayre, Mathieu Coudert
     74