File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
main/scala-2/com/couchbase/client/scala
test/scala/com/couchbase/client/scala Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -308,7 +308,14 @@ class AsyncCluster(
308308 def disconnect (timeout : Duration = env.timeoutConfig.disconnectTimeout()): Future [Unit ] = {
309309 FutureConversions
310310 .javaMonoToScalaFuture(couchbaseOps.shutdown(timeout))
311- .map(_ => if (env.owned) env.shutdown(timeout))
311+ .flatMap(_ =>
312+ if (env.owned) {
313+ // Explicitly put this on the global threadpool, otherwise it will execute on the
314+ // threadpool we are shutting down due to the implicit `ec` in scope.
315+ Future (env.shutdown(timeout))(scala.concurrent.ExecutionContext .global)
316+ } else
317+ Future .successful(())
318+ )
312319 }
313320
314321 /** Returns a `DiagnosticsResult`, reflecting the SDK's current view of all its existing connections to the
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ package com.couchbase.client.scala
22
33import com .couchbase .client .core .env .WanDevelopmentProfile
44import com .couchbase .client .scala .env ._
5- import org .junit .jupiter .api .Test
5+ import org .junit .jupiter .api .{ RepeatedTest , Test }
66
77import scala .concurrent .duration .{Duration , _ }
88import scala .util .{Success , Try }
@@ -144,7 +144,8 @@ class EnvironmentSpec {
144144 }
145145 }
146146
147- @ Test
147+ // Repeated as this has been an intermittent failure in the past
148+ @ RepeatedTest (10 )
148149 def closeOwnedEnvironment (): Unit = {
149150 val clusterTry : Try [Cluster ] = Cluster .connect(" 1.2.3.4" , " username" , " password" )
150151
You can’t perform that action at this time.
0 commit comments