Java數據庫連接池C3P0-0.9.2-pre3 發布
C3P0是一個開放源代碼的JDBC連接池,Hibernate的發行包中默認使用此連接池。傳說性能最好。
C3P0在沉寂了多年之后,終于迎來了更新,目前常用的穩定版是:0.9.1.2,現在最新版本: 0.9.2-pre2(開發版 0.9.2-pre3),C3P0的最新代碼已經遷移到GitHub上了:https://github.com/swaldman/c3p0

0.9.2-pre2下載地址:http://sourceforge.net/projects/c3p0/files/c3p0-bin/
0.9.3-pre3下載地址:https://oss.sonatype.org/content/repositories/snapshots/com/mchange/c3p0/0.9.2-pre3-SNAPSHOT/

Changelog:
c3p0-0.9.2-pre3
Some highlights:
+ Some JDBC drivers freeze up if cached Statements are close()ed while their parent
Connections are in use. Previously users of these drivers (Oracle, JTDS) generally
had to forego Statement caching to avoid deadlocks. C3P0's statement cache can now
be set to cautiously close Statements only when the parent Connections are known
to be idle. If you experience "APPARENT DEADLOCKS" due to StatementCloseTasks, set
c3p0.statementCacheNumDeferredCloseThreads=1
and they should go away!
+ There are some other minor improvements and fixes:
-- the more granular and efficient "scattered" Connection acquisition algorithm that
was "experimental" in the previous release is enabled by default
-- unreturned Connections that are timed out (bad! bad!) are either rolled back (default)
or committed before close(), respecting your unresolved transaction configuration.
(see config parameter unresolvedConnectionTimeout in docs).
+ You must now include two jar files (c3p0 and mchange-commons-java) in your CLASSPATH
rather than just one. Both can be found in the lib directory of the binary distribution.
(Please provide feedback; if this is very inconvenient I can bundle it all up into
a unified jar.)
Some structural changes:
+ Development of c3p0 and mchange-commons-java have migrated to github:
https://github.com/swaldman/c3p0
https://github.com/swaldman/mchange-commons-java
Note that c3p0 depends (heavily) on the mchange-commons library.
c3p0-0.9.2-pre2
-- Added support for deployment to Maven central repository to build.xml,
and noted this version's coordinates in the repository.
-- Added a src directory to the distribution, containing jarred java
sources (including codegenerated sources) intended for debuggers/IDEs.
As a convenience, mchange-commons-java sources are included as well.
-- Fixed issue where idle Connections being tested by the pool
were not properly marked with the statement cache as "in-use".
-- Updated the build file to make it easy to update versions and dates
on source code headers.
-- ResultSets are now automatically closed and their proxies dereferenced
as soon as parent Statements are closed, rather than waiting for the parent
Connection to close as we did before. Thanks to jo-hennig and soronthar for
calling attention to this issue.
-- Modified (in mchange commons library) ThreadPoolAsynchronousRunner to
occasionally (stochastically) call Timer.purge() when maxAdministrativeTaskTime
settings leads to frequent cancellations of TimerTasks. Thanks to Kevin Conaway,
who observed memory issues from the piling up of canceled but unpurged TimerTasks.
-- Modified (in mchange commons library) VersionUtils to be more tolerant
of unusual version Strings. Thanks to martyhu for the suggestion.
-- When a ProxyConnection is marked closed, we now fire a connectionClosed
event even if an Exception occurred during cleanup, to be sure that proxies
detach. We still fire a connectionErrorOccurred prior to connectionClosed,
so that listeners (especially C3P0PooledConnectionPool) can invalidate the
can't-be-cleaned-up PooledConnection.
-- Modified GooGooStatementCache to call clearBatch on PreparedStatement checkin,
so that stale batches from prior use of Statements are never visible to new
users. Many thanks to David Carr for pointing out the problem and the fix.
-- getWarnings and clearWarnings no longer set the txn_known_resolved flag to false.
Thanks to Manuel Darveau for pointing out the unnecessary caution.
-- Gave C3P0PooledConnectionPoolManager's timer a name. Thanks to Matt Kusnierz
for the suggestion.
-- Fixed an infinite loop in ComboPooledDataSource, which occurred following
some Exceptions, which provoked calls to toString() to build the Exception
message, which call itself provoked an Exception, ad infinitum. All potentially
Exception-provoking attribute lookups are now excluded from toString(). Many
thanks to Svante v. Erichsen for calling attention to this problem and
suggesting a fix.
-- Modified the build so that JDK 1.4 compatible versions of c3p0-0.9.2
can be generated easily. (c3p0-0.9.2 will be the last version of c3p0
to support JDK 1.4 builds.)
-- Moved development onto github. See https://github.com/swaldman/c3p0, with
a dependency against https://github.com/swaldman/mchange-commons-java
c3p0-0.9.2-pre1
-- Rationalized management of the ConnectionEventListener that checks in
PooledConnections on proxy Connection close(). Now added on check-out and
removed on check-in, rather than being always present but temporarily removed
during administrative tasks.
-- Implemented asynchronous Statement destroyer, hopefully completing the task of
making the statement cache robust to drivers that cannot deal with Statements
being closed underneath Connections still in use (e.g. Oracle, JTDS). Note
that this implementation requires at least one dedicated Thread for statement
destruction (if we used the common Thread pool, there will be deadlocks as
Statement close tasks await not-in-use Connections, while Connection-related
tasks can't be completed because the Thread pool is saturated with Statement
close tasks. Stats about the asynchronous Statement destroyer are available
via the JMX MBean, prefixed statementDestroyer. Setting the new config parameter
c3p0.statementCacheNumDeferredCloseThreads enables the fix.
-- Resolved a potential race condition that could lead to pool freezes, especially
when acquisitions occasionally fail and acquireIncrement is set to 1. [Many
thanks to Brendan Dougherty for carefully describing this issue.]
-- Added a guard to BasicResourcePool.doAcquire() to ensure that the pool has
not been closed or broken before assimilating a task [Many thanks to
Sean Rohead for tracking down this issue and suggesting the fix.]
-- Made SCATTERED_ACQUIRE_TASK default to true. This provides much better overall
performance for Connection acquisition from potentially unreliable sources
-- Modifed to ensure that unresolved transaction settings apply to expired
unreturned Connections. (see config params autoCommitOnClose and
forceIgnoreUnresolvedTransactions) [Thanks to Matthew Lieder for calling
attention to this issue.]
-- Cleaned up Statement cache fix that ensures no statements are closed while
their parent Connection is in use. By default, the fix is not enabled, because
it's extra work that most databases don't need. [Most drivers support Statement
close() while a parent Connection is in use, so the extra work is unnecessary.]
-- Separated traditional build into two libraries, mchange-commons and c3p0.
-- Modified GooGooStatementCache and C3P0PooledConnectionPool to ensure that
1) the Statement cache knows which Connections are currently in use by outside
clients; and 2) the Statement cache refuses to cull Statements belonging to
Connections in use. Theoretically, drivers should support asynchronous statement
close. In practice, some drivers don't do so nicely, or block pending completion
of other (potentially long) operations, leading to APPARENT DEADLOCKS. (Oracle
users in particular have reported deadlocks in which all pool threads are blocked
on Statement close tasks.) [Many, many thanks to Ovidiu Feodorov for a very detailed
account of problems that occur under c3p0 when very long queries are executed under
Oracle!]
-- Defined a NullMLogger, and modified Log4jMLog to use that, instead of a broken
log4j MLogger, if c3p0's logging library fails to acquire a non-null Log4j logger.
Thanks to Oli Glimmer for calling attention to this issue. (Strange NPEs due to
apparently null log4j loggers have been encountered before, and previous attempts
to resolve apparently weren't adequate.)
-- Fixed a problem whereby ThreadPoolAsynchronousRunner was not robust to Errors provoked
during task execution. [Thanks to George Khoshy for reporting this issue.]
-- Made VersionUtils more robust to cases where some components of the java.version system
property are non-integral [Thanks to Dirk Weigenand for calling attention to this problem,
and suggesting a solution!]
雖然C3P0-0.9.2 還不是穩定版,但是很值得期待,希望性能更好,更穩定。
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!