我尝试使用 ehcache 并且它有效。我只是想用 ehcache RMI 实现分布式缓存。我按照网址中提供的步骤操作:http ://ehcache.org/documentation/distributed_caching_with_rmi.html?cf03800515=21D4D871!NTAxODEzNDE0OmNvcnByYWRpdXNzc286vsRypkVtSPb7t3MnL22gFQ==#
但我找不到分布式缓存工作......
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,
rmiUrls=//<remotemachineip>:<i want to know what port id should be given here>/deviceCache1"/>
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=<localmachineip>,port=<i want to know what port id should be given here>,
socketTimeoutMillis=120000"/>
我给了一些端口号,我在两台机器上都有独立的 java 代码。首先,我在朋友的机器上运行主程序,将数据放入“deviceCache1”,然后我尝试在我的主程序中访问该缓存。但我没有发现两台机器之间发生任何连接。
我可能听起来很傻,但我需要知道一些关于缓存的事情。请有人澄清我的疑问并帮助我。所以,我的问题是: 1. 需要在两台机器的 ehcache.xml 中提供哪些端口 ID?2. 我是否需要启用一些 Windows 服务才能使用 rmi 端口?3.我需要添加任何其他代码来连接两台机器吗?
请尽快帮助我。谢谢