java 什么是 RMI TCP 连接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40793580/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 05:29:28  来源:igfitidea点击:

what is RMI TCP connection

javamemoryoptimizationheapjava-threads

提问by Jake

I'm making a desktop application in java and am doing some memory optimisations. That made me come across two threads running in the JVM, both named:

我正在用 Java 制作一个桌面应用程序,并且正在做一些内存优化。这让我遇到了在 JVM 中运行的两个线程,它们都命名为:

RMI TCP connection

RMI TCP 连接

And they're both contributing to heap growth quite considerably (at my perspective)

而且它们都对堆增长做出了相当大的贡献(在我看来)

Now I don't know much, but TCP sounds to me like it's some internet thing. From what I've managed to find on google, it has something to do with serialization/deserialization over the internet.

现在我知道的不多,但 TCP 对我来说听起来像是一些互联网的东西。从我在谷歌上找到的信息来看,它与互联网上的序列化/反序列化有关。

But my application doesn't need the internet, so I would like to know two things:

但是我的应用程序不需要互联网,所以我想知道两件事:

  1. what are they and what are they doing in my JVM?
  2. Can I get rid of them somehow?
  1. 它们是什么以及它们在我的 JVM 中做什么?
  2. 我能以某种方式摆脱它们吗?

enter image description here

在此处输入图片说明

My tool has been "Java visualVM". A though has crossed my mind that the two threads are spawned as a result of using this tool, in which case I'll feel a bit stupid.

我的工具是“Java visualVM”。虽然我已经想到这两个线程是由于使用这个工具而产生的,在这种情况下我会觉得有点愚蠢。

采纳答案by Gregor Koukkoullis

The threads are used to feed a remote JMX client (in your case Java VisualVM) with data from your JVM.

这些线程用于向远程 JMX 客户端(在您的情况下为 Java VisualVM)提供来自 JVM 的数据。

Once you disconnect the threads should not allocate so much data anymore.

一旦断开连接,线程就不应该再分配这么多数据了。

To verify this you can go to the Threads tab and look at the thread dump of a RMI TCP Connection thread. You should see that the RMI operations trigger JMX beans.

要验证这一点,您可以转到“线程”选项卡并查看 RMI TCP 连接线程的线程转储。您应该看到 RMI 操作触发了 JMX bean。

回答by NetL

RMI is a Java API, which allows you to divide the implementation of parts of the same application on multiple computers. Do you use java.rmi library in your project?

RMI 是一个 Java API,它允许您在多台计算机上划分同一应用程序的部分实现。你在你的项目中使用 java.rmi 库吗?