Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5508

Memory model improvements for Session fields

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.13.0
    • Fix Version/s: 7.0.0-M1, 6.15.0
    • Component/s: wicket
    • Labels:
      None

      Description

      Currently org.apache.wicket.Session#sequence and org.apache.wicket.Session#pageId are primitive ints, non-volatile.

      They are accessed only in their getter methods where they are read and incremented. To make sure their values are correct the getter methods are synchronized on the session instance. This synchronization may lead to slower execution of the getter when another thread/request does something slower in another synchronized method of Session.
      Using AtomicInteger should improve here.

      Other fields of Session like locale and style are not synchronized and different threads may read old value for them. Using AtomicReference should improve this.

      Some special boolean fields like 'dirty' and 'sessionInvalidated' should be made volatile to avoid dirty reads.

      With WICKET-5473 org.apache.wicket.Session#nextPageId() and org.apache.wicket.Session#nextSequenceValue() call #dirty() only for bound sessions. The check whether the session is bound or not should really be in #dirty() itself.

        Attachments

        1. WICKET-5508.patch
          6 kB
          Martin Grigorov
        2. WICKET-5508.patch
          5 kB
          Martin Grigorov
        3. WICKET-5508.patch
          5 kB
          Martin Grigorov

          Activity

            People

            • Assignee:
              mgrigorov Martin Grigorov
              Reporter:
              mgrigorov Martin Grigorov
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: