Uploaded image for project: '[Read Only] - Hippo Site Toolkit 2'
  1. [Read Only] - Hippo Site Toolkit 2
  2. HSTTWO-1171 HST must be extended with site mount authorization.
  3. HSTTWO-1197

Useage of WeakReference<Session> in LazySessionInvoker leads to behavior depending on gc()

    XMLWordPrintable

Details

    • Sub-task
    • Status: Closed
    • Top
    • Resolution: Fixed
    • 2.10.00
    • 2.10.01
    • None
    • None

    Description

      Reproduce: Change in LazySessionDelegatingRepository#testLazySessionObject()

      String userID2 = session2.getUserID();
      assertTrue(((LazySession) session1).isLoaded());

      into

      String userID2 = session2.getUserID();
      System.gc();
      Thread.sleep(100);
      System.gc();
      Thread.sleep(100);
      System.gc();
      assertTrue(((LazySession) session1).isLoaded());

      For some reason the WeakReference<Session> sessionWeakRef; from LazySessionInvoker can be garbage collected. Does the LazySession actualle keep a reference to the invoker? I think something might fail here.

      Furthermore, I am not really happy with the invoking proxies methods and usage of WeakReference's how it is currently done. I might be just not familiar enough with this proxy kind of programming. I am however familiar with WeakReference's, and I just think the current setup is error prone, as this issue also proves.

      Is there not a better solution available?

      Attachments

        Issue Links

          Activity

            People

              wko Woonsan Ko (Inactive)
              aschrijvers Ard Schrijvers
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: