通过 JMX 对对象调用的操作是否在单独的线程中执行?
我有一个通过 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.