Coherence缓存客户端访问不同集群上的不同缓存
我们在不同的集群上有 2 个缓存。我想通过我的扩展客户端访问它们。 我可以很好地访问第一个缓存(任何一个),但访问第二个缓存失败。
例如:
NamedCache cacheOne= CacheFactory.getCache("Cache-One");
NamedCache cacheTwo= CacheFactory.getCache("Cache-Two");
第二次调用将失败并显示:
Exception in thread "main" java.lang.IllegalArgumentException: No scheme for cache: "Cache-Two".
如何通过客户端访问这两个缓存?客户端配置如下
**
<cache-config>
<caching-scheme-mapping>
<cache-mapping>
<cache-name>Cache-One</cache-name>
<scheme-name>Scheme-One</scheme-name>
</cache-mapping>
<cache-mapping>
<cache-name>Cache-Two</cache-name>
<scheme-name>Scheme-Two</scheme-name>
</cache-mapping>
</caching-scheme-mapping>
<caching-schemes>
<remote-cache-scheme>
<scheme-name>Scheme-One</scheme-name>
<service-name>TCPProxyCacheService</service-name>
<initiator-config>
<tcp-initiator>
<remote-addresses>
<socket-address>
<address>address of proxy one</address>
<port>2077</port>
</socket-address>
</remote-addresses>
<connect-timeout>300s</connect-timeout>
</tcp-initiator>
<outgoing-message-handler>
<request-timeout>300s</request-timeout>
</outgoing-message-handler>
</initiator-config>
</remote-cache-scheme>
<remote-cache-scheme>
<scheme-name>extend-castle</scheme-name>
<service-name>TCPProxyCacheService</service-name>
<initiator-config>
<tcp-initiator>
<remote-addresses>
<socket-address>
<address>address of proxy two</address>
<port>20088</port>
</socket-address>
</remote-addresses>
<connect-timeout>300s</connect-timeout>
</tcp-initiator>
<outgoing-message-handler>
<request-timeout>300s</request-timeout>
</outgoing-message-handler>
</initiator-config>
</remote-cache-scheme>
</caching-schemes>
</cache-config>
:
We have 2 caches on different clusters. I want to access both of them via my extend client.
I can access the first cache fine (any one), but then access to second one fails.
For example:
NamedCache cacheOne= CacheFactory.getCache("Cache-One");
NamedCache cacheTwo= CacheFactory.getCache("Cache-Two");
Second call will fail with :
Exception in thread "main" java.lang.IllegalArgumentException: No scheme for cache: "Cache-Two".
How can I access both the caches via the client? Client config is below:
*
<cache-config>
<caching-scheme-mapping>
<cache-mapping>
<cache-name>Cache-One</cache-name>
<scheme-name>Scheme-One</scheme-name>
</cache-mapping>
<cache-mapping>
<cache-name>Cache-Two</cache-name>
<scheme-name>Scheme-Two</scheme-name>
</cache-mapping>
</caching-scheme-mapping>
<caching-schemes>
<remote-cache-scheme>
<scheme-name>Scheme-One</scheme-name>
<service-name>TCPProxyCacheService</service-name>
<initiator-config>
<tcp-initiator>
<remote-addresses>
<socket-address>
<address>address of proxy one</address>
<port>2077</port>
</socket-address>
</remote-addresses>
<connect-timeout>300s</connect-timeout>
</tcp-initiator>
<outgoing-message-handler>
<request-timeout>300s</request-timeout>
</outgoing-message-handler>
</initiator-config>
</remote-cache-scheme>
<remote-cache-scheme>
<scheme-name>extend-castle</scheme-name>
<service-name>TCPProxyCacheService</service-name>
<initiator-config>
<tcp-initiator>
<remote-addresses>
<socket-address>
<address>address of proxy two</address>
<port>20088</port>
</socket-address>
</remote-addresses>
<connect-timeout>300s</connect-timeout>
</tcp-initiator>
<outgoing-message-handler>
<request-timeout>300s</request-timeout>
</outgoing-message-handler>
</initiator-config>
</remote-cache-scheme>
</caching-schemes>
</cache-config>
*
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您已经定义了
extend-castle
方案,其中应该定义了Scheme-Two
方案。将第二个remote-cache-scheme
中的方案名称更改为Scheme-Two
或将第二个cache-mapping
中的方案名称更改为extend -城堡
。You have defined
extend-castle
scheme, whereScheme-Two
scheme should have been defined. Either change scheme name in secondremote-cache-scheme
toScheme-Two
or change scheme name in secondcache-mapping
toextend-castle
.