You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2014/02/13 15:44:25 UTC

[jira] [Created] (WICKET-5508) Memory model improvements for Session fields

Martin Grigorov created WICKET-5508:
---------------------------------------

             Summary: Memory model improvements for Session fields
                 Key: WICKET-5508
                 URL: https://issues.apache.org/jira/browse/WICKET-5508
             Project: Wicket
          Issue Type: Improvement
          Components: wicket
    Affects Versions: 6.13.0
            Reporter: Martin Grigorov
            Assignee: Martin Grigorov


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.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)