Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-1496

Problem to invoke createDataStoreGarbageCollector() in JCASessionHandle object

Agile BoardAttach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Patch Available
    • Major
    • Resolution: Unresolved
    • 1.4
    • None
    • jackrabbit-jca
    • None
    • all

    Description

      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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            jfcorugedo Juan Fernandez-Corugedo

            Dates

              Created:
              Updated:

              Time Tracking

              Estimated:
              Original Estimate - 24h
              24h
              Remaining:
              Remaining Estimate - 24h
              24h
              Logged:
              Time Spent - Not Specified
              Not Specified

              Slack

                Issue deployment