cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r585754 - in /cocoon/trunk/core/cocoon-sitemap: cocoon-sitemap-api/ cocoon-sitemap-api/src/main/java/org/apache/cocoon/components/flow/ cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/flow/
Date Wed, 17 Oct 2007 23:33:08 GMT
Author: vgritsenko
Date: Wed Oct 17 16:33:07 2007
New Revision: 585754

URL: http://svn.apache.org/viewvc?rev=585754&view=rev
Log:
switching continuations to commons logging

Modified:
    cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-api/pom.xml
    cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-api/src/main/java/org/apache/cocoon/components/flow/WebContinuation.java
    cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/flow/ContinuationsManagerImpl.java

Modified: cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-api/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-api/pom.xml?rev=585754&r1=585753&r2=585754&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-api/pom.xml (original)
+++ cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-api/pom.xml Wed Oct 17 16:33:07 2007
@@ -72,6 +72,10 @@
     </dependency>
     <!-- commons -->
     <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+    </dependency>
+    <dependency>
       <groupId>commons-collections</groupId>
       <artifactId>commons-collections</artifactId>
     </dependency>

Modified: cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-api/src/main/java/org/apache/cocoon/components/flow/WebContinuation.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-api/src/main/java/org/apache/cocoon/components/flow/WebContinuation.java?rev=585754&r1=585753&r2=585754&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-api/src/main/java/org/apache/cocoon/components/flow/WebContinuation.java
(original)
+++ cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-api/src/main/java/org/apache/cocoon/components/flow/WebContinuation.java
Wed Oct 17 16:33:07 2007
@@ -23,9 +23,9 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.commons.collections.iterators.IteratorEnumeration;
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
 
 /**
  * Representation of continuations in a Web environment.
@@ -42,8 +42,16 @@
  * @since March 19, 2002
  * @version $Id$
  */
-public class WebContinuation extends AbstractLogEnabled
-                             implements Comparable {
+public class WebContinuation implements Comparable {
+
+    /**
+     * Logger to be used in {@link #display()}.
+     *
+     * <p>Not using here <code>org.apache.cocoon.util.AbstractLogEnabled</code>
+     * because there is no dependency on cocoon-util, and want to avoid
+     * calling LogFactory for each continuation.
+     */
+    private Log logger;
 
     /**
      * The continuation this object represents.
@@ -141,6 +149,14 @@
         if (parentContinuation != null) {
             this.parentContinuation.children.add(this);
         }
+    }
+
+    public final Log getLogger() {
+        return this.logger;
+    }
+
+    public void setLogger(Log logger) {
+        this.logger = logger;
     }
 
     /**

Modified: cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/flow/ContinuationsManagerImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/flow/ContinuationsManagerImpl.java?rev=585754&r1=585753&r2=585754&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/flow/ContinuationsManagerImpl.java
(original)
+++ cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/flow/ContinuationsManagerImpl.java
Wed Oct 17 16:33:07 2007
@@ -27,7 +27,6 @@
 import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
-
 import javax.servlet.http.HttpSession;
 import javax.servlet.http.HttpSessionBindingEvent;
 import javax.servlet.http.HttpSessionBindingListener;
@@ -37,15 +36,16 @@
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.context.ContextException;
 import org.apache.avalon.framework.context.Contextualizable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.thread.ThreadSafe;
+
 import org.apache.cocoon.components.ContextHelper;
 import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.Request;
 import org.apache.cocoon.thread.RunnableManager;
+import org.apache.cocoon.util.AbstractLogEnabled;
 
 
 /**
@@ -67,9 +67,9 @@
  * @see ContinuationsManager
  * @version $Id$
  */
-public class ContinuationsManagerImpl
-        extends AbstractLogEnabled
-        implements ContinuationsManager, Configurable, ThreadSafe, Serviceable, Contextualizable
 {
+public class ContinuationsManagerImpl extends AbstractLogEnabled
+                                      implements ContinuationsManager, Configurable, ThreadSafe,
+                                                 Serviceable, Contextualizable  {
 
     static final int CONTINUATION_ID_LENGTH = 20;
     static final String EXPIRE_CONTINUATIONS = "expire-continuations";
@@ -112,7 +112,8 @@
     protected Context context;
 
     protected long expirationCheckInterval;
-    
+
+
     public ContinuationsManagerImpl() throws Exception {
         try {
             random = SecureRandom.getInstance("SHA1PRNG");
@@ -163,7 +164,6 @@
         int ttl = (timeToLive == 0 ? defaultTimeToLive : timeToLive);
 
         WebContinuation wk = generateContinuation(kont, parent, ttl, interpreterId, disposer);
-        wk.enableLogging(getLogger());
 
         if (parent == null) {
             forest.add(wk);
@@ -262,7 +262,7 @@
                                                  ContinuationsDisposer disposer) {
 
         char[] result = new char[bytes.length * 2];
-        WebContinuation wk = null;
+        WebContinuation wk;
         WebContinuationsHolder continuationsHolder = lookupWebContinuationsHolder(true);
         while (true) {
             random.nextBytes(bytes);
@@ -278,17 +278,18 @@
                 if (!continuationsHolder.contains(id)) {
                     if (this.bindContinuationsToSession)
                         wk = new HolderAwareWebContinuation(id, kont, parent,
-                                ttl, interpreterId, disposer,
-                                continuationsHolder);
+                                                            ttl, interpreterId, disposer,
+                                                            continuationsHolder);
                     else
                         wk = new WebContinuation(id, kont, parent, ttl,
-                                interpreterId, disposer);
+                                                 interpreterId, disposer);
                     continuationsHolder.addContinuation(wk);
                     break;
                 }
             }
         }
 
+        wk.setLogger(getLogger());
         return wk;
     }
 
@@ -321,7 +322,7 @@
      * Detach this continuation from parent. This method removes
      * continuation from {@link #forest} set, or, if it has parent,
      * from parent's children collection.
-     * @param continuationsHolder
+     *
      * @param wk Continuation to detach from parent.
      */
     protected void _detach(WebContinuation wk) {
@@ -431,8 +432,8 @@
         Iterator i = expirations.iterator();
         while (i.hasNext() && ((wk = (WebContinuation) i.next()).hasExpired())) {
             i.remove();
-            WebContinuationsHolder continuationsHolder = null;
-            if ( wk instanceof HolderAwareWebContinuation )
+            WebContinuationsHolder continuationsHolder;
+            if (wk instanceof HolderAwareWebContinuation)
                 continuationsHolder = ((HolderAwareWebContinuation) wk).getContinuationsHolder();
             else
                 continuationsHolder = this.continuationsHolder;



Mime
View raw message