简体   繁体   中英

JSF 2.0 (IceFaces 3.2) ApplicationScoped beans, shared data and PUSH

I'm having a little problem with shared data and push.

I have a table containing three rows; these rows are different depending on a selected reference date (each user may select a different reference date, so it's in a session scope), eg let's say I have:

  • [{1, 'a', "active"}, {2, 'b', "active"}, {3, 'c', "inactive"}] for reference date 10-Feb-13 and
  • [{4, 'a', "inactive"}, {5, 'b', "active"}, {6, 'c', "inactive"}] for reference date 13-Mar-13.

Objects are triples of the kind {ID, LABEL, STATUS}.

The rows should be shared between users watching the same reference date, eg users U1 and U2 are watching the table with reference date 10-Feb-13. ideally, as U1 changes the row {1, 'a', "active"} to "inactive", the modification is propagated to user U2 who sees it too, via Push notification (IcePush actually). So far, so good.

My problem arises when more users watch different reference dates, as I have to filter out the rows not in the user's specific reference date and try to "free" the unneeded ones since the bean is application scoped.

We initially thought we may count users watching a particular reference date, but that would be like reference counting garbage collection, a mess I'm not willing to dive into, so I'm asking you, how would you do it?

By the way, we thought it should work this way because we read this tutorial.

Shared data in application scoped beans cannot be modified per user. Use session scoped beans.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM