cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manfred Riem <mr...@win.tue.nl>
Subject Re: Easter Vacation
Date Fri, 21 Apr 2000 11:55:36 GMT
Hi all,

I've check and rechecked everything, but multiple web-applications
will not work without patching the cocoon engine. I'm using
Tomcat 3.1 and my own 2.2 compliant webserver. Both seem to have
the same problem. I've tracked it down to the Engine itself.

So here is the patch for the impatient, please include this
in the upcoming 1.7.3 release. As I really need it! 

Sorry for the lengthy mail,

Greetz,

Manfred Riem
Computer Science Student
Eindhoven University of Technology


Patch code:

    /**
     * This will return a new instance of the Engine class, and handle
     *   pooling of instances.  In this implementation, one instance is
     *   shared across the JVM.  This replaces using the constructor
     *   directly, because now the Cocoon servlet can initialize the
     *   Engine, and other servlets and classes can use the same engine,
     *   in order to funnel requests through Cocoon.
     *
     * @param confs - Configuration file information
     * @param context - Object to use for Servlet Context
     * @return Engine - instance to operate on
     * @throws Exception - when things go awry
     */
    public static Engine getInstance(Configurations confs, Object context) throws Exception
{

/*
	Change the variable 'instance' to a hashtable containing 
	as keys contexts and values Engine-instances.
	
   private static Hashtable instanceHastable = new Hashtable();
 */
 
      if ( instanceHashtable.get( context ) == null ) {
         synchronized (Engine.class) {
            if (instanceHashtable.get( context ) == null) {
               instanceHashtable.put( context, new Engine(confs, context) );
            }
         }
      }

 		return (Engine) instanceHashtable.get( context );
    }

    /**
     * This is the <code>getInstance()</code> version that should be used by
     *   anything other than the Cocoon servlet itself.  This assumes that
     *   the engine has been set up and is ready to be used.  If this is called
     *   before the instance has been correctly created, it throws an
     *   exception.
     *
     * @return Engine - instance to operate on
     */
    public static Engine getInstance() throws Exception {

      if (!instanceHashtable.isEmpty()) {
         /*
          * Any engine will do???
          */
         Enumeration tEnum = instanceHashtable.elements();
         
         return (Engine) tEnum.nextElement();
      }

        throw new Exception("The Cocoon engine has not been initialized!");
    }
A
 
> Hello,
> 
> I'm going up to the alps for ester vacation with my girlfriend to relax
> and come up with brilliant new ideas for Cocoon. In fact, that is the
> place where Cocoon was invented :)
> 
> See you guys tuesday next week (when we'll do Cocoon 1.7.3)
> 
> Take care.
> 
> -- 
> Stefano Mazzocchi      One must still have chaos in oneself to be
>                           able to give birth to a dancing star.
> <stefano@apache.org>                             Friedrich Nietzsche
> --------------------------------------------------------------------
>  Missed us in Orlando? Make it up with ApacheCON Europe in London!
> ------------------------- http://ApacheCon.Com ---------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 


Mime
View raw message