bloritsch 01/02/16 10:12:00
Modified: src/org/apache/cocoon Tag: xml-cocoon2
CocoonComponentSelector.java ComponentFactory.java
DefaultComponentManager.java
src/org/apache/cocoon/components/language/generator Tag:
xml-cocoon2 CompiledComponent.java
src/org/apache/cocoon/sitemap Tag: xml-cocoon2
AbstractSitemap.java
src/org/apache/cocoon/util Tag: xml-cocoon2
ComponentPool.java
Log:
Start methodology for how to pool XSP pages
Revision Changes Path
No revision
No revision
1.1.2.18 +1 -2
xml-cocoon/src/org/apache/cocoon/Attic/CocoonComponentSelector.java
Index: CocoonComponentSelector.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/CocoonComponentSelector.java,v
retrieving revision 1.1.2.17
retrieving revision 1.1.2.18
diff -u -r1.1.2.17 -r1.1.2.18
--- CocoonComponentSelector.java 2001/02/16 16:21:34 1.1.2.17
+++ CocoonComponentSelector.java 2001/02/16 18:11:34 1.1.2.18
@@ -42,7 +42,7 @@
/** Default component manager for Cocoon's non sitemap components.
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Paul Russell</a>
- * @version CVS $Revision: 1.1.2.17 $ $Date: 2001/02/16 16:21:34 $
+ * @version CVS $Revision: 1.1.2.18 $ $Date: 2001/02/16 18:11:34 $
*/
public class CocoonComponentSelector implements Contextualizable,
ComponentSelector, Composer, Configurable, ThreadSafe, Loggable {
protected Logger log;
@@ -66,7 +66,6 @@
/** Parent Component Manager */
private ComponentManager manager;
-
/** Construct a new default component manager.
*/
1.1.2.7 +16 -1
xml-cocoon/src/org/apache/cocoon/Attic/ComponentFactory.java
Index: ComponentFactory.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/ComponentFactory.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- ComponentFactory.java 2001/01/22 21:56:32 1.1.2.6
+++ ComponentFactory.java 2001/02/16 18:11:37 1.1.2.7
@@ -10,6 +10,7 @@
import org.apache.avalon.util.pool.ObjectFactory;
import org.apache.avalon.Poolable;
+import org.apache.avalon.util.pool.Pool;
import org.apache.avalon.Configuration;
import org.apache.avalon.ComponentManager;
@@ -20,9 +21,11 @@
import org.apache.log.Logger;
import org.apache.avalon.Loggable;
+import
org.apache.cocoon.components.language.generator.AbstractCompiledComponent;
+
/** Factory for Cocoon components.
* @author <a href="mailto:[EMAIL PROTECTED]">Paul Russell</a>
- * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/01/22 21:56:32 $
+ * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/02/16 18:11:37 $
*/
public class ComponentFactory implements ObjectFactory, ThreadSafe, Loggable
{
private Logger log;
@@ -40,6 +43,14 @@
*/
private ComponentManager manager;
+ private Pool pool;
+
+ public void setPool(Pool pool) {
+ if (this.pool == null) {
+ this.pool = pool;
+ }
+ }
+
/** Construct a new component factory for the specified component.
* @param componentClass the class to instantiate (must have a default
constructor).
* @param config the <code>Configuration</code> object to pass to new
instances.
@@ -74,6 +85,10 @@
if ( comp instanceof Composer) {
((Composer)comp).compose(this.manager);
+ }
+
+ if ( comp instanceof AbstractCompiledComponent) {
+ ((AbstractCompiledComponent) comp).setPool(this.pool);
}
return comp;
1.1.2.17 +1 -2
xml-cocoon/src/org/apache/cocoon/Attic/DefaultComponentManager.java
Index: DefaultComponentManager.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/DefaultComponentManager.java,v
retrieving revision 1.1.2.16
retrieving revision 1.1.2.17
diff -u -r1.1.2.16 -r1.1.2.17
--- DefaultComponentManager.java 2001/02/15 21:09:32 1.1.2.16
+++ DefaultComponentManager.java 2001/02/16 18:11:38 1.1.2.17
@@ -40,7 +40,7 @@
/** Default component manager for Cocoon's non sitemap components.
* @author <a href="mailto:[EMAIL PROTECTED]">Paul Russell</a>
- * @version CVS $Revision: 1.1.2.16 $ $Date: 2001/02/15 21:09:32 $
+ * @version CVS $Revision: 1.1.2.17 $ $Date: 2001/02/16 18:11:38 $
*/
public class DefaultComponentManager implements ComponentManager,
Configurable, Loggable {
@@ -64,7 +64,6 @@
/** Component pools. */
private Map pools;
-
/** Construct a new default component manager.
*/
No revision
No revision
1.1.2.3 +4 -2
xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/CompiledComponent.java
Index: CompiledComponent.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/CompiledComponent.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- CompiledComponent.java 2001/02/16 16:21:36 1.1.2.2
+++ CompiledComponent.java 2001/02/16 18:11:47 1.1.2.3
@@ -9,13 +9,15 @@
import org.apache.avalon.Composer;
import org.apache.avalon.Modifiable;
+import org.apache.avalon.Poolable;
+import org.apache.avalon.Recyclable;
/**
* This interface is the common base of all Compiled Components. This
* includes Sitemaps and XSP Pages
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/02/16 16:21:36 $
+ * @version CVS $Revision: 1.1.2.3 $ $Date: 2001/02/16 18:11:47 $
*/
-public interface CompiledComponent extends Composer, Modifiable {
+public interface CompiledComponent extends Composer, Poolable, Recyclable,
Modifiable {
}
No revision
No revision
1.1.2.20 +3 -5
xml-cocoon/src/org/apache/cocoon/sitemap/Attic/AbstractSitemap.java
Index: AbstractSitemap.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/AbstractSitemap.java,v
retrieving revision 1.1.2.19
retrieving revision 1.1.2.20
diff -u -r1.1.2.19 -r1.1.2.20
--- AbstractSitemap.java 2001/02/14 11:39:10 1.1.2.19
+++ AbstractSitemap.java 2001/02/16 18:11:53 1.1.2.20
@@ -28,23 +28,21 @@
import org.apache.cocoon.Roles;
import org.apache.cocoon.components.url.URLFactory;
import org.apache.cocoon.components.classloader.RepositoryClassLoader;
+import
org.apache.cocoon.components.language.generator.AbstractCompiledComponent;
import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.sitemap.ComponentHolderFactory;
import org.apache.cocoon.sitemap.SitemapComponentManager;
import org.apache.cocoon.util.ClassUtils;
-import org.apache.avalon.AbstractLoggable;
-//import org.apache.log.Logger;
-
import org.xml.sax.SAXException;
/**
* Base class for generated <code>Sitemap</code> classes
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.19 $ $Date: 2001/02/14 11:39:10 $
+ * @version CVS $Revision: 1.1.2.20 $ $Date: 2001/02/16 18:11:53 $
*/
-public abstract class AbstractSitemap extends AbstractLoggable implements
Sitemap {
+public abstract class AbstractSitemap extends AbstractCompiledComponent
implements Sitemap {
private static final int BYTE_ARRAY_SIZE = 1024;
No revision
No revision
1.1.2.4 +18 -6
xml-cocoon/src/org/apache/cocoon/util/Attic/ComponentPool.java
Index: ComponentPool.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/util/Attic/ComponentPool.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- ComponentPool.java 2001/01/22 21:56:53 1.1.2.3
+++ ComponentPool.java 2001/02/16 18:11:57 1.1.2.4
@@ -13,6 +13,7 @@
import org.apache.avalon.util.pool.AbstractPool;
import org.apache.avalon.util.pool.ObjectFactory;
import org.apache.avalon.util.pool.PoolController;
+import org.apache.cocoon.ComponentFactory;
import org.apache.log.Logger;
@@ -31,12 +32,18 @@
public ComponentPool(final ObjectFactory factory,
final PoolController controller) throws Exception {
super(factory, controller, DEFAULT_POOL_SIZE/2, DEFAULT_POOL_SIZE);
+ if (factory instanceof ComponentFactory) {
+ ((ComponentFactory) factory).setPool(this);
+ }
}
public ComponentPool(final ObjectFactory factory,
final PoolController controller,
final int initial) throws Exception {
super(factory, controller, initial, initial);
+ if (factory instanceof ComponentFactory) {
+ ((ComponentFactory) factory).setPool(this);
+ }
}
public ComponentPool(final ObjectFactory factory,
@@ -44,6 +51,9 @@
final int initial,
final int maximum) throws Exception {
super(factory, controller, initial, maximum);
+ if (factory instanceof ComponentFactory) {
+ ((ComponentFactory) factory).setPool(this);
+ }
}
public void setLogger(Logger log) {
@@ -61,9 +71,10 @@
synchronized(m_pool) {
Poolable component = super.get();
log.debug(
- "ComponentPool retrieved "
- + component.getClass().getName()
- + " (" + component.toString() + ")"
+ (new StringBuffer("ComponentPool retrieved "))
+ .append(component.getClass().getName())
+ .append(" (").append(component.toString()).append(")")
+ .toString()
);
return component;
}
@@ -78,9 +89,10 @@
synchronized(m_pool) {
super.put(poolable);
log.debug(
- "ComponentPool returned "
- + poolable.getClass().getName()
- + " (" + poolable.toString() + ")"
+ (new StringBuffer("ComponentPool returned "))
+ .append(poolable.getClass().getName())
+ .append(" (").append(poolable.toString()).append(")")
+ .toString()
);
}
}