You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2004/03/18 08:42:12 UTC

cvs commit: cocoon-2.1/src/java/org/apache/cocoon/transformation/helpers DefaultIncludeCacheManager.java

cziegeler    2004/03/17 23:42:12

  Modified:    .        status.xml
               src/java/org/apache/cocoon/transformation/helpers
                        DefaultIncludeCacheManager.java
  Log:
     <action dev="CZ" type="fix" fixes-bug="27764" due-to="Corin Moss" due-to-email="cmoss@tvnz.co.nz">
       DefaultIncludeCacheManager did not release xml-serializer under some circumstances.
     </action>
  
  Revision  Changes    Path
  1.285     +4 -1      cocoon-2.1/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/status.xml,v
  retrieving revision 1.284
  retrieving revision 1.285
  diff -u -r1.284 -r1.285
  --- status.xml	17 Mar 2004 09:29:14 -0000	1.284
  +++ status.xml	18 Mar 2004 07:42:11 -0000	1.285
  @@ -212,6 +212,9 @@
     <changes>
   
    <release version="@version@" date="@date@">
  +   <action dev="CZ" type="fix" fixes-bug="27764" due-to="Corin Moss" due-to-email="cmoss@tvnz.co.nz">
  +     DefaultIncludeCacheManager did not release xml-serializer under some circumstances.
  +   </action>
      <action dev="CZ" type="fix" fixes-bug="27681" due-to="Peter Brant" due-to-email="peter.brant@courts.state.wi.us">
        DOMFactory can now create a document element.
      </action>
  
  
  
  1.8       +21 -16    cocoon-2.1/src/java/org/apache/cocoon/transformation/helpers/DefaultIncludeCacheManager.java
  
  Index: DefaultIncludeCacheManager.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/transformation/helpers/DefaultIncludeCacheManager.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultIncludeCacheManager.java	5 Mar 2004 13:03:00 -0000	1.7
  +++ DefaultIncludeCacheManager.java	18 Mar 2004 07:42:12 -0000	1.8
  @@ -20,13 +20,13 @@
   
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.component.Component;
  -import org.apache.avalon.framework.component.ComponentException;
  -import org.apache.avalon.framework.component.ComponentManager;
  -import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.parameters.ParameterException;
   import org.apache.avalon.framework.parameters.Parameterizable;
   import org.apache.avalon.framework.parameters.Parameters;
  +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.ProcessingException;
   import org.apache.cocoon.caching.CachedResponse;
  @@ -62,12 +62,12 @@
       extends AbstractLogEnabled
       implements IncludeCacheManager, 
                   ThreadSafe, 
  -                Composable, 
  +                Serviceable, 
                   Disposable,
                   Parameterizable, 
                   Component {
   
  -    private ComponentManager manager;
  +    private ServiceManager manager;
       
       private SourceResolver   resolver;
       
  @@ -180,7 +180,7 @@
                   if (this.getLogger().isDebugEnabled()) {
                       this.getLogger().debug("Thread started for " + uri);
                   }
  -            } catch (ComponentException ce) {
  +            } catch (ServiceException ce) {
                   throw new SourceException("Unable to lookup thread pool or xml serializer.", ce);
               } catch (Exception e) {
                   throw new SourceException("Unable to get pooled thread.", e);
  @@ -273,7 +273,7 @@
                   deserializer = (XMLDeserializer)this.manager.lookup( XMLDeserializer.ROLE );
                   deserializer.setConsumer(handler);
                   deserializer.deserialize(result);
  -            } catch (ComponentException ce) {
  +            } catch (ServiceException ce) {
                   throw new SAXException("Unable to lookup xml deserializer.", ce);
               } finally {
                   this.manager.release( deserializer );
  @@ -302,7 +302,7 @@
                           deserializer = (XMLDeserializer)this.manager.lookup( XMLDeserializer.ROLE );
                           deserializer.setConsumer(handler);
                           deserializer.deserialize(response.getResponse());
  -                    } catch (ComponentException ce) {
  +                    } catch (ServiceException ce) {
                           throw new SAXException("Unable to lookup xml deserializer.", ce);
                       } finally {
                           this.manager.release( deserializer );
  @@ -355,8 +355,10 @@
               
           } catch (ProcessingException pe) {
               throw new SAXException("ProcessingException", pe);
  -        } catch (ComponentException e) {
  +        } catch (ServiceException e) {
               throw new SAXException("Unable to lookup xml serializer.", e);
  +        } finally {
  +            this.manager.release(serializer);
           }
       }
   
  @@ -371,9 +373,9 @@
       }
   
       /**
  -     * @see org.apache.avalon.framework.component.Composable#compose(org.apache.avalon.framework.component.ComponentManager)
  +     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
        */
  -    public void compose(ComponentManager manager) throws ComponentException {
  +    public void service(ServiceManager manager) throws ServiceException {
           this.manager = manager;
           this.resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
       }
  @@ -406,7 +408,7 @@
           final String storeRole = parameters.getParameter("use-store", Store.ROLE);
           try {
               this.store = (Store)this.manager.lookup(storeRole);
  -        } catch (ComponentException e) {
  +        } catch (ServiceException e) {
               throw new ParameterException("Unable to lookup store with role " + storeRole, e);
           }
           this.defaultCacheStorage = new StoreIncludeCacheStorageProxy(this.store, this.getLogger());
  @@ -421,13 +423,15 @@
       boolean  finished;
       Exception exception;
       byte[]    content;
  -
  +    ServiceManager manager;
  +    
       public LoaderThread(Source source, 
  -                         XMLSerializer serializer, 
  -                         ComponentManager manager) {
  +                        XMLSerializer serializer,
  +                        ServiceManager manager) {
           this.source = source;
           this.serializer = serializer;
           this.finished = false;
  +        this.manager = manager;
       }
       
       public void run() {
  @@ -437,6 +441,7 @@
           } catch (Exception local) {
               this.exception = local;
           } finally {
  +            this.manager.release( this.serializer );
               this.finished = true;
           }
       }