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

Memory model improvements for Session fields

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 6.13.0
    • 7.0.0-M1, 6.15.0
    • wicket
    • 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
          5 kB
          Martin Tzvetanov Grigorov
        2. WICKET-5508.patch
          5 kB
          Martin Tzvetanov Grigorov
        3. WICKET-5508.patch
          6 kB
          Martin Tzvetanov Grigorov

        Activity

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

          People

            mgrigorov Martin Tzvetanov Grigorov
            mgrigorov Martin Tzvetanov Grigorov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment