You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ron Piterman <rp...@gmx.net> on 2005/12/20 18:47:24 UTC
using hivemind registry in unit testing: threads not cleaning up
Hi,
We use hivemind registry in JUnit, and it seems not to clean up threads,
so all hivemind sessions remain open, causing very fast all database
connections to be used :(
Does anyone know the problem and, more important, a solution?
Cheers,
Ron
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: using hivemind registry in unit testing: threads not cleaning up
Posted by Jesse Kuhnert <jk...@gmail.com>.
I meant more like connection pooling (or hibernate session) factories being
managed by hivemind.
You could do that in a setup and teardown method, but it may get a little
heavy. We are cheating by using testng though, where you can easily specify
methods that should be run before/after a suite/class/method. So, in our
case, we just do it once before the suite and then cleanupThread after.
Testng is nice sometimes :)
On 12/20/05, Ron Piterman <rp...@gmx.net> wrote:
>
> Thanx Jesse,
> I don't understand what zou mean with calling hivemind factories, but
> maybe its important to know we currently only test our business layer,
> so if you meant tapestry-factories than its irrelevant.
>
> So if I get it right, I have to add Registry.setupThread/cleanupThread
> in the Test's setUp and tearDown...
>
> Thanx alot,
> Ron
>
>
>
> Jesse Kuhnert wrote:
> > Hivemind only cleans up threads that you tell it to manage, ie
> > Registry.setupThread()/Registry.cleanupThread().
> >
> > We had the same problem momentarily in our unit tests, until we tracked
> down
> > the problem to that. Also be sure that you're not calling methods
> directly
> > on hivemind factories that would otherwise be called by an injected
> > session..Otherwise that thread too will not be managed.
> >
> > Tapestry does this for you by calling setupThread()/cleanupThread()
> within
> > the ApplicationServlet that it uses. (If you choose to use it.)
> >
> > On 12/20/05, Ron Piterman <rp...@gmx.net> wrote:
> >
> >>Hi,
> >>
> >>We use hivemind registry in JUnit, and it seems not to clean up threads,
> >>so all hivemind sessions remain open, causing very fast all database
> >>connections to be used :(
> >>
> >>Does anyone know the problem and, more important, a solution?
> >>
> >>Cheers,
> >>Ron
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
Re: using hivemind registry in unit testing: threads not cleaning
up
Posted by Ron Piterman <rp...@gmx.net>.
Thanx Jesse,
I don't understand what zou mean with calling hivemind factories, but
maybe its important to know we currently only test our business layer,
so if you meant tapestry-factories than its irrelevant.
So if I get it right, I have to add Registry.setupThread/cleanupThread
in the Test's setUp and tearDown...
Thanx alot,
Ron
Jesse Kuhnert wrote:
> Hivemind only cleans up threads that you tell it to manage, ie
> Registry.setupThread()/Registry.cleanupThread().
>
> We had the same problem momentarily in our unit tests, until we tracked down
> the problem to that. Also be sure that you're not calling methods directly
> on hivemind factories that would otherwise be called by an injected
> session..Otherwise that thread too will not be managed.
>
> Tapestry does this for you by calling setupThread()/cleanupThread() within
> the ApplicationServlet that it uses. (If you choose to use it.)
>
> On 12/20/05, Ron Piterman <rp...@gmx.net> wrote:
>
>>Hi,
>>
>>We use hivemind registry in JUnit, and it seems not to clean up threads,
>>so all hivemind sessions remain open, causing very fast all database
>>connections to be used :(
>>
>>Does anyone know the problem and, more important, a solution?
>>
>>Cheers,
>>Ron
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: using hivemind registry in unit testing: threads not cleaning up
Posted by Jesse Kuhnert <jk...@gmail.com>.
Hivemind only cleans up threads that you tell it to manage, ie
Registry.setupThread()/Registry.cleanupThread().
We had the same problem momentarily in our unit tests, until we tracked down
the problem to that. Also be sure that you're not calling methods directly
on hivemind factories that would otherwise be called by an injected
session..Otherwise that thread too will not be managed.
Tapestry does this for you by calling setupThread()/cleanupThread() within
the ApplicationServlet that it uses. (If you choose to use it.)
On 12/20/05, Ron Piterman <rp...@gmx.net> wrote:
>
> Hi,
>
> We use hivemind registry in JUnit, and it seems not to clean up threads,
> so all hivemind sessions remain open, causing very fast all database
> connections to be used :(
>
> Does anyone know the problem and, more important, a solution?
>
> Cheers,
> Ron
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>