通过 JMX 对对象调用的操作是否在单独的线程中执行?

发布于 2024-08-04 16:51:39 字数 152 浏览 1 评论 0原文

我有一个通过 JMX 公开的 Java 对象,我想知道当我使用 JMX (即通过 JConsole 或类似的东西)调用它的操作时,该操作是否发生在单独的线程中。

我需要知道这一点,以便知道是否需要在 Java 代码中使该操作成为线程安全的(即访问 ArrayList 等)。

I have a Java object which is exposed via JMX and I'm wondering when I invoke an operation on it using JMX (i.e. via JConsole or something similar) if that operation occurs in a separate thread or not.

I need to know this so I know whether or not I need to make that operation in my Java code thread-safe (i.e. accessing an ArrayList, etc).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

盗琴音 2024-08-11 16:51:39

JConsole 是一个独立于目标 JVM 的进程,因此 JVM 必须生成一个新线程来服务该请求。如果同时出现多个 JConsole 操作,则目标代码必须是线程安全的。

Well JConsole is a separate process from the target JVM, and so the JVM would have to spawn a new thread to service the request. If multiple JConsole operations come in al the same time, then the target code would have to be thread safe.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文