cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <>
Subject 'dispose' method of component
Date Wed, 29 Oct 2003 13:21:33 GMT
Hi All

I am working with the 'authentication-fw' in FlowScript, having added  
an authenticator that uses Hibernate. ie. My authentication pipeline is  
now a FlowScript which calls an internal pipeline to produce the  
authentication XML for the framework.

I am finding that the 'dispose' method of my Hibernate component (based  
on Hugo Burm's HibernateFactory) never gets called, until I quit Jetty,  
which is not what I expected.

This is my authenticator script:

// this function is called internally by the auth-fw,
// to get a pipeline to return an authentication XML stream
function authenticate () {
   var username = cocoon.parameters["user"];
   var password = cocoon.parameters["pass"];
   var factory =  
   var session = factory.createSession();
   try {
     var user = Packages.[long.path.deleted].UserPeer.login(session,  
username, password, null);
     if (user != null) ("Got User : " +; //  
lubbly jubbly
     cocoon.sendPage ("screen/authenticate", {user: user}); // a  
JXTemplateGenerator pipeline
   } catch (e) {
     cocoon.log.error (e.getMessage ());
   } finally {        //catch (return) not working ("Disposing of Factory"); // I see this message
     cocoon.releaseComponent(factory); // I do not see the log message  
from the dispose method

public class HibernateFactory
   extends AbstractLogEnabled
   implements PersistanceFactory, Configurable, Serviceable,  
Initializable, Disposable, ThreadSafe

The dispose method looks like this:

public final void dispose()  {
   //if (getLogger().isDebugEnabled()) getLogger().debug("Hibernate  
dispose called");
   // why oh why is this logger null!!!!
   System.out.println ("Hibernate dispose called"); // I never see this
   try {
   } catch ( Exception e) {
     //if (getLogger().isErrorEnabled()) getLogger().error("Hibernate:"  
+ e.getMessage());
     System.out.println ("Hibernate:" + e.getMessage());
   }  finally {
     sf = null;
   this.disposed = true;
   this.manager = null;

I thought cocoon.releaseComponent(factory) should call the dispose  
method .....
Is there a method it will call if I provided one?

Thanks for any suggestions.

regards Jeremy

View raw message