Permalink
Browse files

Try "inUseCount" as field name

  • Loading branch information...
trevorsibanda committed Jul 4, 2017
1 parent fb9258a commit 4a401b4dbdf6765a7cba3fe67cba16e085003ae2
@@ -14,6 +14,7 @@ import slick.util.SlickLogger
import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
import scala.util.{Try, Success}
class SlickInUseCountTest extends AsyncTest[JdbcTestDB] {
@@ -84,7 +85,11 @@ class SlickInUseCountTest extends AsyncTest[JdbcTestDB] {
val threadPoolExecutor = threadPoolExecutorField.get(asyncExecutor)
val queue = threadPoolExecutor.getClass.getMethod("getQueue").invoke(threadPoolExecutor)
val inUseCountField = queue.getClass.getDeclaredField("slick$util$ManagedArrayBlockingQueue$$inUseCount")
val inUseCountField = Seq("inUseCount", "slick$util$ManagedArrayBlockingQueue$$inUseCount").collectFirst{name =>
Try(queue.getClass.getDeclaredField(name)) match{
case Success(field) => field
}
}.get
inUseCountField.setAccessible(true)
inUseCountField.get(queue).asInstanceOf[Int]

0 comments on commit 4a401b4

Please sign in to comment.