JMX RMI代理容错机制

发布于 2024-11-10 12:54:30 字数 255 浏览 3 评论 0原文

我正在使用 JMX-RMI 代理进行消息传递。我有一个java程序,它将具有名称/id的消息发送到一组侦听器/侦听器。根据侦听器收到的消息,客户端程序会做出相应的行为。这一部分工作正常,但我想知道是什么样的容错功能内置于 JMX RMI 代理中。

如果侦听器意外停止,JMX 是否会重新启动它或在某处记录错误,如果两侧的消息队列已满怎么办?任何解释 JMX RMI 底层架构或内置容错机制的文档都将受到赞赏。如果它没有任何容错机制,那么有什么好的方法呢?

非常感谢

I am using the JMX-RMI agent for message passing. I have a java program which sends a message having a name/id to a set of listener/listeners.Based on the message received by the listeners the client side programs behave accordingly.This piece works fine but I would like to know what kind of fault tolerance is built in into the JMX RMI agent.

If the listener stops accidentally, does JMX restart it or logs the error somewhere,what if the message queue on either side is full. Any documentation which explains the underlying architecture of JMX RMI or the in built fault tolerance mechanism will be appreciated. If it doesn't have any fault tolerance mechanisms, what would be a good way of doing it.

Thanks Much

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

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

发布评论

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

评论(1

心奴独伤 2024-11-17 12:54:30

我假设您的客户端侦听器正在使用标准 javax.management.remote 连接器。如果没有一些自定义,我想说您可以实现一些简单的故障检测。对于容错,您可能正在寻找某种集群解决方案。

您需要关注两层连接:

  1. MBeanServerConnection 本身。换句话说,如果整个服务器端 JVM 终止,您的客户端进程需要知道。
  2. 虽然服务器 JVM 和辅助 MBeanServerConnection 可能继续可用,但“托管”侦​​听器/客户端消息转发器服务本身可能会停止/失败/停顿。

对于#1,客户端进程可以注册 NotificationListener JMXConnector 使用 addConnectionNotificationListener 方法。然后,您的本地连接将发出 JMXConnectionNotifications 发生以下所有事件:

  • 已打开新的客户端连接。
  • 客户端连接已关闭。
  • 客户端连接意外失败。
  • 客户端连接可能丢失通知。此通知仅出现在客户端。

这样,您的客户端就会知道与服务器的连接何时建立和丢失。

对于#2,它对于您的应用程序来说更加具体,但也许您可以采用这样的简单模式:

当您的侦听器/转发器服务启动时,发出启动通知。当它停止时,发出停止通知。注册这些通知的两类侦听器是:

  1. 客户端,因此他们知道服务已启动/停止。
  2. 服务器端“观察者”,可以侦听“停止”并重新启动服务。

这或多或少是你的想法吗?

I am assuming your client side listeners are using the standard javax.management.remote connectors. Without some customization, I would say you can implement some straightforward Fault Detection. For Fault Tolerance you're probably looking at some sort of clustering solution.

There are two layers of connectivity you need to be concerned about:

  1. The MBeanServerConnection itself. In other words, if the whole server side JVM terminates, your client side processes need to know.
  2. While the server JVM and the subsidiary MBeanServerConnection may continue to be available, the "hosted", the listener/client message forwarder service itself may stop/fail/stall.

For #1, the client processes can register a NotificationListener with the JMXConnector using the addConnectionNotificationListener method. Your local connection will then emit JMXConnectionNotifications on all the following events:

  • A new client connection has been opened.
  • A client connection has been closed.
  • A client connection has failed unexpectedly.
  • A client connection has potentially lost notifications. This notification only appears on the client side.

This way, your clients will know when a connection to the server has been established and lost.

For #2, it's a bit more specific to your application, but perhaps you can adapt a simple pattern like this:

When your listener/forwarder service starts, emit a start-notification. When it stops,emit a stopped-notification. The two categories of listeners that would register for these notifications would be:

  1. The clients, so they know the service has started/stopped.
  2. A server side "watcher" that can listen for a "stop" and restart the service.

Is that more-or-less what you were thinking of ?

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