You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@toree.apache.org by lr...@apache.org on 2023/08/10 16:34:54 UTC
[incubator-toree] branch master updated: [TOREE-548] Call shutdown to close ZQM Context in ZeroMQSocketRunnableSpec (#214)
This is an automated email from the ASF dual-hosted git repository.
lresende pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-toree.git
The following commit(s) were added to refs/heads/master by this push:
new 9e408a30 [TOREE-548] Call shutdown to close ZQM Context in ZeroMQSocketRunnableSpec (#214)
9e408a30 is described below
commit 9e408a30d1656bd593fdd2cf7474dc76cc5019c9
Author: Cheng Pan <ch...@apache.org>
AuthorDate: Fri Aug 11 00:34:49 2023 +0800
[TOREE-548] Call shutdown to close ZQM Context in ZeroMQSocketRunnableSpec (#214)
---
.../toree/communication/socket/ZeroMQSocketRunnableSpec.scala | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala b/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala
index 384e3770..ea9d592b 100644
--- a/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala
+++ b/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala
@@ -22,6 +22,7 @@ import org.scalatest.time.{Milliseconds, Seconds, Span}
import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
import org.zeromq.{SocketType, ZMQ}
import org.zeromq.ZMQ.{Context, Socket}
+import zmq.Ctx
import scala.util.Try
@@ -61,7 +62,14 @@ class ZeroMQSocketRunnableSpec extends FunSpec with Matchers
}
after {
- Try(zmqContext.close())
+ Try {
+ val ctxFiled = classOf[ZMQ.Context].getClass.getDeclaredField("ctx")
+ ctxFiled.setAccessible(true)
+ val ctx = ctxFiled.get(zmqContext).asInstanceOf[Ctx]
+ val shutdownMethod = classOf[Ctx].getDeclaredMethod("shutdown")
+ shutdownMethod.setAccessible(true)
+ shutdownMethod.invoke(ctx)
+ }
}
describe("ZeroMQSocketRunnable") {