r1109 - in xwiki/trunk/src/main/java/com/xpn/xwiki: . cache/api cache/impl

Ludovic Dubost ludovic at users.forge.objectweb.org
Mon Jul 31 23:51:28 CEST 2006


Author: ludovic
Date: 2006-07-31 23:51:27 +0200 (Mon, 31 Jul 2006)
New Revision: 1109

Modified:
   xwiki/trunk/src/main/java/com/xpn/xwiki/XWiki.java
   xwiki/trunk/src/main/java/com/xpn/xwiki/cache/api/XWikiCache.java
   xwiki/trunk/src/main/java/com/xpn/xwiki/cache/impl/OSCacheCache.java
Log:
Fixed a bug (regression) that made the group service be recreated each time and therefore the cache be recreated also

Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/XWiki.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/XWiki.java	2006-07-31 18:10:53 UTC (rev 1108)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/XWiki.java	2006-07-31 21:51:27 UTC (rev 1109)
@@ -2771,7 +2771,7 @@
         this.rightService = rightService;
     }
 
-    public XWikiGroupService getGroupService(XWikiContext context) throws XWikiException {
+    public synchronized XWikiGroupService getGroupService(XWikiContext context) throws XWikiException {
         if (groupService == null) {
             String groupClass;
             if (isExo())
@@ -2788,8 +2788,8 @@
                 else
                     groupService = new XWikiGroupServiceImpl();
             }
+            groupService.init(this, context);
         }
-        groupService.init(this, context);
         return groupService;
     }
 
@@ -2798,7 +2798,7 @@
     }
 
     // added some log statements to make debugging easier - LBlaze 2005.06.02
-    public XWikiAuthService getAuthService() {
+    public synchronized XWikiAuthService getAuthService() {
         if (authService == null) {
 
             log.info("Initializing AuthService...");
@@ -2849,7 +2849,7 @@
     }
 
     // added some log statements to make debugging easier - LBlaze 2005.06.02
-    public XWikiRightService getRightService() {
+    public synchronized XWikiRightService getRightService() {
         if (rightService == null) {
 
             log.info("Initializing RightService...");
@@ -2884,7 +2884,7 @@
         return rightService;
     }
 
-    public XWikiStatsService getStatsService(XWikiContext context) {
+    public synchronized XWikiStatsService getStatsService(XWikiContext context) {
         if (statsService == null) {
             if ("1".equals(Param("xwiki.stats", "1"))) {
                 String storeClass = Param("xwiki.stats.class", "com.xpn.xwiki.stats.impl.XWikiStatsServiceImpl");
@@ -2900,7 +2900,7 @@
         return statsService;
     }
 
-    public XWikiURLFactoryService getURLFactoryService() {
+    public synchronized XWikiURLFactoryService getURLFactoryService() {
         if (urlFactoryService == null) {
 
             log.info("Initializing URLFactory Service...");

Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/cache/api/XWikiCache.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/cache/api/XWikiCache.java	2006-07-31 18:10:53 UTC (rev 1108)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/cache/api/XWikiCache.java	2006-07-31 21:51:27 UTC (rev 1109)
@@ -1,24 +1,24 @@
-/*
- * Copyright 2006, XpertNet SARL, and individual contributors as indicated
- * by the contributors.txt.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *
- * @author sdumitriu
- */
+/*
+ * Copyright 2006, XpertNet SARL, and individual contributors as indicated
+ * by the contributors.txt.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * @author sdumitriu
+ */
 
 package com.xpn.xwiki.cache.api;
 
@@ -29,6 +29,7 @@
     void putInCache(String key, Object obj);
     Object getFromCache(String key) throws XWikiCacheNeedsRefreshException;
     Object getFromCache(String key, int refeshPeriod) throws XWikiCacheNeedsRefreshException;
+    int getNumberEntries();
     void cancelUpdate(String key);
     void flushAll();
 }

Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/cache/impl/OSCacheCache.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/cache/impl/OSCacheCache.java	2006-07-31 18:10:53 UTC (rev 1108)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/cache/impl/OSCacheCache.java	2006-07-31 21:51:27 UTC (rev 1109)
@@ -156,6 +156,12 @@
      */
     public int getNumberEntries()
     {
+       int ret = cacheAdmin.getCache().getSize();
+       return ret;
+    }
+
+    public int getSize()
+    {
         return cacheAdmin.getCache().getSize();
     }
 





More information about the Xwiki-notifications mailing list