jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Caligiuri (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-1496) Problem to invoke createDataStoreGarbageCollector() in JCASessionHandle object
Date Wed, 04 Jun 2008 10:29:45 GMT

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

Marco Caligiuri commented on JCR-1496:
--------------------------------------

Try this:

((SessionImpl)((JCASessionHandle)session).getWorkspace().getSession()).createDataStoreGarbageCollector()

> Problem to invoke createDataStoreGarbageCollector() in JCASessionHandle object
> ------------------------------------------------------------------------------
>
>                 Key: JCR-1496
>                 URL: https://issues.apache.org/jira/browse/JCR-1496
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-jca
>    Affects Versions: 1.4
>         Environment: all
>            Reporter: Juan Fernandez-Corugedo
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> It's imposible to execute the followin code:
> import org.apache.jackrabbit.core.data.GarbageCollector;
> ...
> GarbageCollector gc;
> SessionImpl si = (SessionImpl)session;
> gc = si.createDataStoreGarbageCollector();
> // optional (if you want to implement a progress bar / output):
> gc.setScanEventListener(this);
> gc.scan();
> gc.stopScan();
> // could be a separate button, if multiple repositories use the same data store:
> gc.deleteUnused();
> It throws a ClassCastException, because with JCA, the session object is of type JCASessionHandle.
> I have solve this bug by changing the private method getSession() of the JCASessionHandle
class to public. 
> CURRENT IMPLEMENTATION:
> private Session getSession() {
>         return mc.getSession(this);
> }
> MODIFICATION:
> public Session getSession() {
>         return mc.getSession(this);
> }
> And the final code look's like this:
> SessionImpl si = (SessionImpl)((org.apache.jackrabbit.jca.JCASessionHandle)session).getSession();
> ┬┐There are other solution more clean?
> Greetings.

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


Mime
View raw message