I am using HiveMind v1.1.1  with Hibernate to manage a multi-threaded database 
application that uses HiveMind as the central factory for all 
interfaces/classes. I have adopted the ISessionOwner/SessionOwnerImpl session 
Hibernate management pattern from Kent Truong's e-book 'Enjoying Web 
Development with Tapestry'.

I have defined the following interface:

public interface ISessionOwner extends Discardable {
    Session getSession();
}

And the following implementation:

public class SessionOwnerImpl implements ISessionOwner, Discardable {
        public Session getSession() {
                ...
        }

        public void threadDidDiscardService() {
                LOGGER.debug("discarding instance of SessionOwner");
                ...
        }
}

The hivemodule.xml snippet for this service point is:

    <service-point id="ISessionOwner" 
                interface="com.altosresearch.ISessionOwner">
        <invoke-factory model="threaded">
            <construct class="com.altosresearch.SessionOwnerImpl"/>
        </invoke-factory>
    </service-point>

I have confirmed that the basic functionality (instantiation) works just fine. 
Callers to Registry.getService(ISessionOwner.class) are indeed being returned 
instances of SessionOwnerImpl on a per-thread basis.

The objects that are obtaining references to these instances are running in 
the 'main' thread as well as from within one of several ThreadPoolExecutors 
that I use.

However, when any of these threads terminate or the application exits, I do 
not see the log message "discarding instance of SessionOwner" ever appear in 
my log files.

I have inserted similar statments into the finalize() method for this class, 
but I do not see those being recorded either.

I am using JDK1.5_06 on RedHat ES3.0.  I invoke the application via an ant 
task, from the command line, with fork="true".

I'm hoping that I am just doing something obviously wrong here. Anyone have 
any pointers/suggestions?

Thanks,
jason

-- 
Jason L. Buberel -- www.buberel.org -- skype:jbuberel
+1.650.483.1989  -- im:[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to