Github user papegaaij commented on the issue:
https://github.com/apache/wicket/pull/233
No, a boolean won't work. Suppose the following happens: A thread calls
storeTouchedPages, setting the boolean to true. At the same time, another
thread unbinds the session, calling valueUnbound. This will leak the page
store. We only want valueUnbound to be ignored when its a side effect of
calling storeTouchedPages. This is local to the thread calling the method,
hence ThreadLocal.---
