Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

Commit

Permalink
Preventing c3p0 data source from occasionally initializing twice.
Browse files Browse the repository at this point in the history
  • Loading branch information
inca committed May 23, 2013
1 parent 8940321 commit 7ee48e3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion orm/src/main/scala/config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,15 @@ class SimpleConnectionProvider(val driverClass: String,
ds
}

@volatile
protected var _ds: DataSource = null

def dataSource: DataSource = {
if (_ds == null)
_ds = createDataSource
this.synchronized {
if (_ds == null)
_ds = createDataSource
}
_ds
}

Expand Down

0 comments on commit 7ee48e3

Please sign in to comment.