List<JChannel> list = new ArrayList<JChannel>();
if (parentChannel != null) {
list.add(parentChannel);
return list;
}
JGroupsTransport transport;
while (service.cacheManager == null) {
notReadyMessage("Cache manager is not ready", failOnNotReady);
Thread.yield();
}
// For local caches it has there is no transport - check that we have at least one clustered cache
boolean hasClustered = false;
for (String cacheName : service.cacheManager.getCacheNames()) {
if (service.isCacheClustered(service.cacheManager.getCache(cacheName))) {
hasClustered = true;
break;
}
}
if (!hasClustered) return list;
for (;;) {
transport = (JGroupsTransport) ((DefaultCacheManager) service.cacheManager).getTransport();
if (transport != null) break;
notReadyMessage("Transport is not ready", failOnNotReady);
Thread.yield();
}
JChannel channel;
for(;;) {
channel = (JChannel) transport.getChannel();
if (channel != null && channel.getName() != null && channel.isOpen()) break;
notReadyMessage("Channel " + channel + " is not ready", failOnNotReady);
Thread.yield();
}
list.add(channel);