Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Getting list of cache names

967759Oct 11 2012 — edited Oct 12 2012
I have been using this code to get the list of all the cache names of my cluster :
------

Cluster cluster=CacheFactory.ensureCluster();
for (Enumeration<String> services = cluster.getServiceNames(); services.hasMoreElements(); )
{
String sName = (String) services.nextElement();
System.out.println("Service:"+sName);
Service service=cluster.getService(sName);
if (service instanceof CacheService){
CacheService cService=(CacheService)service;
Enumeration<String> caches = cService.getCacheNames();
for (caches = cService.getCacheNames(); caches.hasMoreElements();){
// add caches.nextElement() in a list
}
}
}

------

It is working fine but in order to access multiple clusters I have to use Coherence proxy/extend.

When I use proxy/extend, the code above does not work anymore. I explain: when using proxy/extend, cluster.getServiceNames() returns Management and Cluster but does not return the Cache Services anymore.

I have tried to get a cluster object in a different way :

((InvocationService) CacheFactory.getConfigurableCacheFactory().ensureService("ExtendTcpInvocationService")).getCluster;

where ExtendTcpInvocationService is defined with <remote-invocation-scheme> but the result is the same.


To sum up : I would like to get the list of all my cache names in a multi-cluster application ; is it possible?
This post has been answered by Jonathan.Knight on Oct 12 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 9 2012
Added on Oct 11 2012
4 comments
711 views