Skip to content

Commit

Permalink
closeCallsExceeding from default path
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-alfers committed Nov 26, 2024
1 parent 381d1c4 commit 4811554
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@ object R2dbcSession {
}.asJava

/**
* Provide a custom connectionFactory and an optional config path to load closeCallsExceeding from.
* Provide a custom connectionFactory. The config closeCallsExceeding is loaded from the default path.
*/
def withSession[A](
system: ActorSystem[_],
connectionFactory: ConnectionFactory,
configPath: Optional[String],
fun: JFunction[R2dbcSession, CompletionStage[A]]): CompletionStage[A] = {
scaladsl.R2dbcSession.withSession(system, connectionFactory, configPath.toScala) { scaladslSession =>
scaladsl.R2dbcSession.withSession(system, connectionFactory) { scaladslSession =>
val javadslSession = new R2dbcSession(scaladslSession.connection)(system.executionContext, system)
fun(javadslSession).asScala
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ object R2dbcSession {
fun: R2dbcSession => Future[A]): Future[A] = {
val connectionFactoryProvider = ConnectionFactoryProvider(system)
val connectionFactory = connectionFactoryProvider.connectionFactoryFor(connectionFactoryConfigPath)
withSession(system, connectionFactory, Some(connectionFactoryConfigPath))(fun)
withSession(system, connectionFactory)(fun)
}

/**
* Provide a custom connectionFactory and an optional config path to load closeCallsExceeding from.
* Provide a custom connectionFactory. The config closeCallsExceeding is loaded from the default path.
*/
def withSession[A](system: ActorSystem[_], connectionFactory: ConnectionFactory, configPath: Option[String])(
def withSession[A](system: ActorSystem[_], connectionFactory: ConnectionFactory)(
fun: R2dbcSession => Future[A]): Future[A] = {
val poolConfig = system.settings.config.getConfig(configPath.getOrElse(connectionFactoryConfigPath(system)))
val poolConfig = system.settings.config.getConfig(connectionFactoryConfigPath(system))
val poolSettings = new ConnectionPoolSettings(poolConfig)
val r2dbcExecutor =
new R2dbcExecutor(connectionFactory, log, logDbCallsDisabled, poolSettings.closeCallsExceeding)(
Expand Down

0 comments on commit 4811554

Please sign in to comment.