Permalink
Browse files

Using native hsqldb connection pooling.

  • Loading branch information...
1 parent ceb19ca commit 3b5f2a131305341218c01e7bbd32a44e912ed308 @sbtourist committed Jul 20, 2012
Showing with 5 additions and 12 deletions.
  1. +0 −1 project.clj
  2. +5 −11 src/nimrod/core/store.clj
View
@@ -11,7 +11,6 @@
[com.typesafe.config/config "0.2.0"]
[tayler/tayler "1.1"]
[org.hsqldb/hsqldb "2.2.9-SNAPSHOT"]
- [c3p0/c3p0 "0.9.1.2"]
[org.slf4j/slf4j-api "1.6.1"]
[org.slf4j/slf4j-log4j12 "1.6.1"]]
:repositories {"typesafe" "http://repo.typesafe.com/typesafe/releases"}
@@ -8,7 +8,7 @@
[nimrod.core.math]
[nimrod.core.util]
[nimrod.internal.stats])
- (:import com.mchange.v2.c3p0.ComboPooledDataSource)
+ (:import org.hsqldb.jdbc.JDBCPool)
(:refer-clojure :exclude (resultset-seq)))
(defonce default-cache-entries 1000)
@@ -241,23 +241,17 @@
(when (seq sampling) (log/info (str "Sampling with: " sampling)))
(let [defrag-limit (or (options "defrag.limit") default-defrag-limit)
cache-entries (or (options "cache.entries") default-cache-entries)
- pool (doto (ComboPooledDataSource.)
- (.setDriverClass "org.hsqldb.jdbc.JDBCDriver")
- (.setJdbcUrl (str
+ pool (doto (JDBCPool.)
+ (.setUrl (str
"jdbc:hsqldb:file:" path ";"
"shutdown=true;hsqldb.applog=2;hsqldb.log_size=50;hsqldb.cache_file_scale=128;"
"hsqldb.defrag_limit=" defrag-limit ";"
"hsqldb.cache_rows=" cache-entries ";"
"hsqldb.cache_size=" cache-entries))
(.setUser "SA")
- (.setPassword "")
- (.setMinPoolSize 1)
- (.setMaxPoolSize 10)
- (.setInitialPoolSize 0)
- (.setAcquireIncrement 1)
- (.setNumHelperThreads 5))
+ (.setPassword ""))
store (DiskStore. {:datasource pool} (ref nil) options sampling)]
- (.addShutdownHook (Runtime/getRuntime) (proxy [Thread] [] (run [] (.close pool))))
+ (.addShutdownHook (Runtime/getRuntime) (proxy [Thread] [] (run [] (.close pool 1))))
(init store)
store))
([path options] (new-disk-store path options {}))

0 comments on commit 3b5f2a1

Please sign in to comment.