Coherence缓存客户端访问不同群集上的不同缓存

时间:2011-12-16 21:13:27

标签: caching client cluster-computing extend oracle-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>

*

1 个答案:

答案 0 :(得分:1)

您已定义extend-castle方案,其中应定义Scheme-Two方案。在第二个remote-cache-schemeScheme-Two中更改方案名称,或在第二个cache-mapping中将方案名称更改为extend-castle