hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason L. Buberel" <ja...@buberel.org>
Subject Re: Discardable.threadDidDiscard not being invoked problem
Date Mon, 06 Feb 2006 08:23:19 GMT
That would explain why threadDidDiscardService() is not invoked. But is the 
use of the ThreadPoolExecutor also the cause of the finalize() method never 
being called?

As for the cleanupThread() , I will read through the docs (and possibly steal 
some code from Tapestry :) to figure out what i need to do). It looks like I 
need to have each of the objects that I insert into my threadpool register 
listener themselves as listeners with the registry. Is that correct? 

Thanks,
jason

On Monday 06 February 2006 00:07, Knut Wannheden wrote:
> Jason,
>
> The threads will have to clean up after them selves in order to make
> HiveMind discard the service implementations. See
> http://jakarta.apache.org/hivemind/hivemind/apidocs/org/apache/hivemind/Reg
>istry.html#cleanupThread()
>
> HTH,
>
> --knut
>
> On 2/5/06, Jason L. Buberel <jason@buberel.org> wrote:
> > 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:jason@im.buberel.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org

-- 
Jason L. Buberel -- www.buberel.org -- skype:jbuberel
+1.650.483.1989  -- im:jason@im.buberel.org

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Mime
View raw message