HibernateSessionManager and background threads

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

HibernateSessionManager and background threads

Ilya Obshadko-2
I have recently noticed in my GC logs that application leaks memory after
running periodic background process which performs database operations. I'm
suspicious of Hibernate not cleaning up after himself. So the question is:
are there any specific techniques for using Hibernate in background
processes (i.e. via PeriodicExecutor)?

Any suggestions appreciated.

--
Ilya Obshadko
Reply | Threaded
Open this post in threaded view
|

Re: HibernateSessionManager and background threads

Lance Java
You'll need to @Inject the PerThreadManager and call cleanupThread() in the
finally block of the task(s).
On 1 Nov 2015 14:58, "Ilya Obshadko" <[hidden email]> wrote:

> I have recently noticed in my GC logs that application leaks memory after
> running periodic background process which performs database operations. I'm
> suspicious of Hibernate not cleaning up after himself. So the question is:
> are there any specific techniques for using Hibernate in background
> processes (i.e. via PeriodicExecutor)?
>
> Any suggestions appreciated.
>
> --
> Ilya Obshadko
>
Reply | Threaded
Open this post in threaded view
|

Re: HibernateSessionManager and background threads

Ilya Obshadko-2
Thanks a lot, that seemed to finally help - instance is now running for 5
days without OOM.

On Sun, Nov 1, 2015 at 8:16 PM, Lance Java <[hidden email]>
wrote:

> You'll need to @Inject the PerThreadManager and call cleanupThread() in the
> finally block of the task(s).
> On 1 Nov 2015 14:58, "Ilya Obshadko" <[hidden email]> wrote:
>
> > I have recently noticed in my GC logs that application leaks memory after
> > running periodic background process which performs database operations.
> I'm
> > suspicious of Hibernate not cleaning up after himself. So the question
> is:
> > are there any specific techniques for using Hibernate in background
> > processes (i.e. via PeriodicExecutor)?
> >
> > Any suggestions appreciated.
> >
> > --
> > Ilya Obshadko
> >
>



--
Ilya Obshadko