Index: src/main/java/com/xpn/xwiki/cache/impl/OSCacheService.java
===================================================================
--- src/main/java/com/xpn/xwiki/cache/impl/OSCacheService.java	(revision 10234)
+++ src/main/java/com/xpn/xwiki/cache/impl/OSCacheService.java	(working copy)
@@ -49,6 +49,7 @@
     private static final String PROPS_FILENAME       = "oscache.properties";
     private static final String LOCAL_PROPS_FILENAME = "oscache-local.properties";
     private static final String PROPS_PATH       = "/WEB-INF/";
+    private static final String PROPS_CACHE_NAME = "cache.name";
 
     private XWiki               xwiki;
     private Properties          cacheProperties;
@@ -85,6 +86,7 @@
 
     public XWikiCache newCache(String cacheName, Properties props) throws XWikiException
     {
+        props.put(PROPS_CACHE_NAME, cacheName);
         OSCacheCache cc = new OSCacheCache(mergeProperties(props, cacheProperties));
         cc.setName(cacheName);
         initCache(cc);
@@ -98,7 +100,9 @@
         return cc;
     }
 
-    public XWikiCache newCache(String cacheName, Properties props, int capacity) throws XWikiException {
+    public XWikiCache newCache(String cacheName, Properties props, int capacity) throws XWikiException 
+    {
+        props.put(PROPS_CACHE_NAME, cacheName);
         OSCacheCache cc = new OSCacheCache(mergeProperties(props, cacheProperties), capacity);
         cc.setName(cacheName);
         initCache(cc);
@@ -130,15 +134,21 @@
     }
 
 
-    public XWikiCache newCache(String cacheName) throws XWikiException {
-        OSCacheCache cc = new OSCacheCache(cacheProperties);
+    public XWikiCache newCache(String cacheName) throws XWikiException 
+    {
+        Properties props = new Properties();
+        props.put(PROPS_CACHE_NAME, cacheName);
+        OSCacheCache cc = new OSCacheCache(mergeProperties(props, cacheProperties));
         cc.setName(cacheName);
         initCache(cc);
         return cc;
     }
 
-    public XWikiCache newCache(String cacheName, int capacity) throws XWikiException {
-        OSCacheCache cc = new OSCacheCache(cacheProperties, capacity);
+    public XWikiCache newCache(String cacheName, int capacity) throws XWikiException 
+    {
+        Properties props = new Properties();
+        props.put(PROPS_CACHE_NAME, cacheName);
+        OSCacheCache cc = new OSCacheCache(mergeProperties(props, cacheProperties), capacity);
         cc.setName(cacheName);
         initCache(cc);
         return cc;
@@ -146,8 +156,8 @@
 
     private void initCache(OSCacheCache cc)
     {
-        cacheCount++;
-        cc.setName("Cache # " + cacheCount);
+        //cacheCount++;
+        //cc.setName("Cache # " + cacheCount);
 
         if (log.isInfoEnabled())
         {
Index: src/main/java/com/xpn/xwiki/cache/impl/SharedJavaGroupsBroadcastingListener.java
===================================================================
--- src/main/java/com/xpn/xwiki/cache/impl/SharedJavaGroupsBroadcastingListener.java	(revision 10234)
+++ src/main/java/com/xpn/xwiki/cache/impl/SharedJavaGroupsBroadcastingListener.java	(working copy)
@@ -41,13 +41,15 @@
     private static final String BUS_NAME = "OSCacheBus";
     private static final String CHANNEL_PROPERTIES = "cache.cluster.properties";
     private static final String MULTICAST_IP_PROPERTY = "cache.cluster.multicast.ip";
+    private static final String PROP_CACHE_NAME = "cache.name";
+    private static final String CACHE_NAME="xwiki.store.pagecache";
 
     /**
      * The name to use for the origin of cluster events. Using this ensures
      * events are not fired recursively back over the cluster.
      */
     protected static final String CLUSTER_ORIGIN = "CLUSTER";
-    protected Map cacheMap = new HashMap();
+    protected Cache theCache = null;
 
     /**
      * The first half of the default channel properties. They default channel properties are:
@@ -99,12 +101,17 @@
      * already been initialized.
      */
     public synchronized void initialize(Cache cache, Config config) throws InitializationException {
-        String name = cache.getName();
-        if (cacheMap.get(name)!=null) {
-            if (log.isErrorEnabled())
-                log.error("A cache with name " + name + " has already been registered");
+        String name = config.getProperty(PROP_CACHE_NAME);
+        
+        if(CACHE_NAME.equals(name) )
+        {
+            theCache=cache;
         }
-        cacheMap.put(name, cache);
+        else
+        {
+            log.info("Cache " + name + "will not be clustered");
+            return;
+        }
 
         String properties = config.getProperty(CHANNEL_PROPERTIES);
         String multicastIP = config.getProperty(MULTICAST_IP_PROPERTY);
@@ -133,15 +140,25 @@
             busCount++;
             log.info("JavaGroups clustering support started successfully");
         } catch (Exception e) {
-            throw new InitializationException("Initialization failed: " + e);
+          //try once more
+            try{
+                if (bus==null) {
+                    bus = new NotificationBus(BUS_NAME, properties);
+                    bus.start();
+                    bus.getChannel().setOpt(Channel.LOCAL, new Boolean(false));
+                    bus.setConsumer(this);
+                }
+                busCount++;
+                log.info("JavaGroups clustering support started successfully");
+            } catch(Exception e2)
+            {
+                
+                throw new InitializationException("Initialization failed: " + e2);
+            }
         }
     }
 
 
-    public Cache getCache(String cacheName) {
-        return (Cache) cacheMap.get(cacheName);
-    }
-
     public void cacheEntryAdded(CacheEntryEvent cacheEntryEvent) {
     }
 
@@ -161,7 +178,11 @@
                 log.debug("cacheEntryFlushed called (" + event + ")");
             }
 
-            sendNotification(new ClusterSharedNotification(event.getMap().getName(), ClusterNotification.FLUSH_KEY, event.getKey()));
+            //send notifications only for the cache that we are interested in
+            if(event.getMap() == theCache)
+            {
+                sendNotification(new ClusterSharedNotification(event.getMap().getName(), ClusterNotification.FLUSH_KEY, event.getKey()));
+            }
         }
     }
 
@@ -176,7 +197,10 @@
                 log.debug("cacheGroupFushed called (" + event + ")");
             }
 
-            sendNotification(new ClusterSharedNotification(event.getMap().getName(), ClusterNotification.FLUSH_GROUP, event.getGroup()));
+            if(event.getMap()==theCache)
+            {
+                sendNotification(new ClusterSharedNotification(event.getMap().getName(), ClusterNotification.FLUSH_GROUP, event.getGroup()));
+            } 
         }
     }
 
@@ -186,7 +210,10 @@
                 log.debug("cachePatternFushed called (" + event + ")");
             }
 
-            sendNotification(new ClusterSharedNotification(event.getMap().getName(), ClusterNotification.FLUSH_PATTERN, event.getPattern()));
+            if(event.getMap()==theCache)
+            {
+                sendNotification(new ClusterSharedNotification(event.getMap().getName(), ClusterNotification.FLUSH_PATTERN, event.getPattern()));
+            } 
         }
     }
 
@@ -196,7 +223,10 @@
                 log.debug("cacheFushed called (" + event + ")");
             }
 
-            sendNotification(new ClusterSharedNotification(event.getCache().getName(), ClusterNotification.FLUSH_CACHE, event.getDate()));
+            if(event.getCache()==theCache)
+            {
+                sendNotification(new ClusterSharedNotification(event.getCache().getName(), ClusterNotification.FLUSH_CACHE, event.getDate()));
+            }
         }
     }
 
@@ -208,8 +238,8 @@
      * @param message The incoming cluster notification message object.
      */
     public void handleClusterNotification(ClusterSharedNotification message) {
-        Cache cache = getCache(message.getCacheName());
-        if (cache == null) {
+        
+        if (theCache == null) {
             log.warn("A cluster notification (" + message + ") was received, but the cache named " + message.getCacheName() + " is not registered on this machine. Notification ignored.");
 
             return;
@@ -221,16 +251,16 @@
 
         switch (message.getType()) {
             case ClusterNotification.FLUSH_KEY:
-                cache.flushEntry((String) message.getData(), CLUSTER_ORIGIN);
+                theCache.flushEntry((String) message.getData(), CLUSTER_ORIGIN);
                 break;
             case ClusterNotification.FLUSH_GROUP:
-                cache.flushGroup((String) message.getData(), CLUSTER_ORIGIN);
+                theCache.flushGroup((String) message.getData(), CLUSTER_ORIGIN);
                 break;
             case ClusterNotification.FLUSH_PATTERN:
-                cache.flushPattern((String) message.getData(), CLUSTER_ORIGIN);
+                theCache.flushPattern((String) message.getData(), CLUSTER_ORIGIN);
                 break;
             case ClusterNotification.FLUSH_CACHE:
-                cache.flushAll((Date) message.getData(), CLUSTER_ORIGIN);
+                theCache.flushAll((Date) message.getData(), CLUSTER_ORIGIN);
                 break;
             default:
                 log.error("The cluster notification (" + message + ") is of an unknown type. Notification ignored.");
