-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue 5: Connection pool is being redefined when using journal and sn…
…apshot store
- Loading branch information
dvriend
committed
Sep 12, 2014
1 parent
a834aff
commit 99a0c2a
Showing
10 changed files
with
100 additions
and
59 deletions.
There are no files selected for viewing
11 changes: 0 additions & 11 deletions
11
src/main/scala/akka/persistence/jdbc/common/ScalikeConnection.scala
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
src/main/scala/akka/persistence/jdbc/extension/ScalikeExtension.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package akka.persistence.jdbc.extension | ||
|
||
import akka.actor.{ExtendedActorSystem, Extension, ExtensionId, ExtensionIdProvider} | ||
import akka.persistence.jdbc.common.PluginConfig | ||
import scalikejdbc.{AutoSession, ConnectionPool} | ||
|
||
object ScalikeExtension extends ExtensionId[ScalikeExtensionImpl] with ExtensionIdProvider { | ||
override def createExtension(system: ExtendedActorSystem): ScalikeExtensionImpl = new ScalikeExtensionImpl(system) | ||
|
||
override def lookup() = ScalikeExtension | ||
} | ||
|
||
class ScalikeExtensionImpl(system: ExtendedActorSystem) extends Extension { | ||
implicit val session = AutoSession | ||
val cfg = PluginConfig(system) | ||
val poolName = "akka-persistence-jdbc" | ||
|
||
Class.forName(cfg.driverClassName) | ||
ConnectionPool.singleton(cfg.url, cfg.username, cfg.password) | ||
} |
19 changes: 13 additions & 6 deletions
19
src/main/scala/akka/persistence/jdbc/journal/Journals.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
package akka.persistence.jdbc.journal | ||
|
||
class PostgresqlSyncWriteJournal extends JdbcSyncWriteJournal with PostgresqlStatements | ||
import akka.persistence.jdbc.extension.ScalikeExtension | ||
import scalikejdbc.DBSession | ||
|
||
class MysqlSyncWriteJournal extends JdbcSyncWriteJournal with MySqlStatements | ||
trait GenericJdbcSyncWriteJournal extends JdbcSyncWriteJournal with GenericStatements { | ||
override implicit val session: DBSession = ScalikeExtension(system).session | ||
} | ||
|
||
class H2SyncWriteJournal extends JdbcSyncWriteJournal with H2Statements | ||
class PostgresqlSyncWriteJournal extends GenericJdbcSyncWriteJournal with PostgresqlStatements | ||
|
||
class OracleSyncWriteJournal extends JdbcSyncWriteJournal with OracleStatements | ||
class MysqlSyncWriteJournal extends GenericJdbcSyncWriteJournal with MySqlStatements | ||
|
||
class MSSqlServerSyncWriteJournal extends JdbcSyncWriteJournal with MSSqlServerStatements | ||
class H2SyncWriteJournal extends GenericJdbcSyncWriteJournal with H2Statements | ||
|
||
class InformixSyncWriteJournal extends JdbcSyncWriteJournal with InformixStatements | ||
class OracleSyncWriteJournal extends GenericJdbcSyncWriteJournal with OracleStatements | ||
|
||
class MSSqlServerSyncWriteJournal extends GenericJdbcSyncWriteJournal with MSSqlServerStatements | ||
|
||
class InformixSyncWriteJournal extends GenericJdbcSyncWriteJournal with InformixStatements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 13 additions & 6 deletions
19
src/main/scala/akka/persistence/jdbc/snapshot/SnapshotStores.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
package akka.persistence.jdbc.snapshot | ||
|
||
class PostgresqlSyncSnapshotStore extends JdbcSyncSnapshotStore with PostgresqlStatements | ||
import akka.persistence.jdbc.extension.ScalikeExtension | ||
import scalikejdbc.DBSession | ||
|
||
class MysqlSyncSnapshotStore extends JdbcSyncSnapshotStore with MySqlStatements | ||
trait GenericSyncSnapshotStore extends JdbcSyncSnapshotStore with GenericStatements { | ||
override implicit val session: DBSession = ScalikeExtension(system).session | ||
} | ||
|
||
class H2SyncSnapshotStore extends JdbcSyncSnapshotStore with H2Statements | ||
class PostgresqlSyncSnapshotStore extends GenericSyncSnapshotStore with PostgresqlStatements | ||
|
||
class OracleSyncSnapshotStore extends JdbcSyncSnapshotStore with OracleStatements | ||
class MysqlSyncSnapshotStore extends GenericSyncSnapshotStore with MySqlStatements | ||
|
||
class MSSqlServerSyncSnapshotStore extends JdbcSyncSnapshotStore with MSSqlServerStatements | ||
class H2SyncSnapshotStore extends GenericSyncSnapshotStore with H2Statements | ||
|
||
class InformixSyncSnapshotStore extends JdbcSyncSnapshotStore with InformixStatements | ||
class OracleSyncSnapshotStore extends GenericSyncSnapshotStore with OracleStatements | ||
|
||
class MSSqlServerSyncSnapshotStore extends GenericSyncSnapshotStore with MSSqlServerStatements | ||
|
||
class InformixSyncSnapshotStore extends GenericSyncSnapshotStore with InformixStatements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters