Reconnect RMI client after server restart

后端 未结 2 1390
你的背包
你的背包 2020-12-30 06:54

I have an RMI server and a desktop RMI client. When I restart the server, I get errors in the client. Is it possible to restart the RMI connection without restarting the cli

相关标签:
2条回答
  • 2020-12-30 07:04

    When the server is terminated, you will receive a ConnectException. After that you can just use Naming.lookup to get a new server object.

    0 讨论(0)
  • 2020-12-30 07:17

    If you're using Spring (namely RmiProxyFactoryBean), you can simply set the property refreshStubOnConnectFailure to true and the bean will survive a restart of the server.

    <property name="refreshStubOnConnectFailure" value="true" />
    
    0 讨论(0)
提交回复
热议问题