[ 
https://issues.apache.org/jira/browse/JCR-2106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12708452#action_12708452
 ] 

Thomas Mueller commented on JCR-2106:
-------------------------------------

Hm, the GarbageCollector object could be garbage collected before the session 
is closed.
That means keeping a hard reference from the GarbageCollector to the listener
wouldn't help, right?

It looks like we need a new method GarbageCollector.close(), and a finalize() 
method
(in case people forgot to call close()).

> SystemSessions created for GarbageCollector are not logged out of
> -----------------------------------------------------------------
>
>                 Key: JCR-2106
>                 URL: https://issues.apache.org/jira/browse/JCR-2106
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-core
>    Affects Versions: 1.5.5
>            Reporter: Peter Dettman
>            Assignee: Thomas Mueller
>            Priority: Minor
>         Attachments: JCR-2106-2nd.patch, JCR-2106.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> I have a simple garbage collection task that runs periodically. After 
> upgrading to 1.5.5 it started logging a warning shortly after each run:
> 2009-05-09 03:44:45,480 WARN [org.apache.jackrabbit.core.SessionImpl] - 
> <Unclosed session detected. The session was opened here: >
> java.lang.Exception: Stack Trace
>       at org.apache.jackrabbit.core.SessionImpl.<init>(SessionImpl.java:239)
>       at 
> org.apache.jackrabbit.core.SystemSession.<init>(SystemSession.java:76)
>       at 
> org.apache.jackrabbit.core.SystemSession.create(SystemSession.java:64)
>       at 
> org.apache.jackrabbit.core.SessionImpl.createDataStoreGarbageCollector(SessionImpl.java:649)
> So it's not my session, but an internally created SystemSession.
> Code I'm using:
>             getTemplate().execute(new JcrCallback()
>             {
>                 public Object doInJcr(Session session)
>                     throws IOException, RepositoryException {
>                     SessionImpl sessionImpl = (SessionImpl)session;
>                     GarbageCollector gc = 
> sessionImpl.createDataStoreGarbageCollector();
>                     gc.scan();
>                     gc.stopScan();
>                     gc.deleteUnused();
>                     return null;
>                 }
>             }, true);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to