DWR

DefaultScriptSessionManager is not thread safe

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 3.0.RC2
  • Fix Version/s: None
  • Component/s: Reverse Ajax
  • Documentation Required:
    No
  • Description:
    Hide
    DefaultScriptSessionManager maintains the following map
       ConcurrentMap<String, Set<DefaultScriptSession>> pageSessionMap

    The method "associateScriptSessionAndHttpSession(DefaultScriptSession scriptSession, String httpSessionId)" uses a HashSet which is not thread safe. The implementation should be changed to use either a CopyOnWriteArraySet or a ConcurrentMap (with empty values) instead.
    Show
    DefaultScriptSessionManager maintains the following map    ConcurrentMap<String, Set<DefaultScriptSession>> pageSessionMap The method "associateScriptSessionAndHttpSession(DefaultScriptSession scriptSession, String httpSessionId)" uses a HashSet which is not thread safe. The implementation should be changed to use either a CopyOnWriteArraySet or a ConcurrentMap (with empty values) instead.

Activity

Hide
David Marginian added a comment - 17/May/12 5:29 AM

Thanks Lance. Do you have commit privileges still? If so go ahead and make the change.

Show
David Marginian added a comment - 17/May/12 5:29 AM Thanks Lance. Do you have commit privileges still? If so go ahead and make the change.
Hide
Lance added a comment - 17/May/12 6:02 AM

I'd forgotten that I even had commit privelages I'll take a look when I get some time.

NB. In java 6 we could do:
Set<String> concurrentSet = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());

Since I think DWR is 1.5 compatible, I will have to mimmic that behaviour.

Show
Lance added a comment - 17/May/12 6:02 AM I'd forgotten that I even had commit privelages I'll take a look when I get some time. NB. In java 6 we could do: Set<String> concurrentSet = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>()); Since I think DWR is 1.5 compatible, I will have to mimmic that behaviour.
Hide
David Marginian added a comment - 17/May/12 7:15 AM

Yeah I know. I actually changed some code to use newSetFromMap and then realized I was running Java 6 and had to revert the changes.

Show
David Marginian added a comment - 17/May/12 7:15 AM Yeah I know. I actually changed some code to use newSetFromMap and then realized I was running Java 6 and had to revert the changes.
Hide
Mike Wilson added a comment - 19/May/12 12:57 PM

This is actually a duplicate of DWR-574 even though that report's title may be misleading. I'm closing as Duplicate anyway, and we can continue the discussion in that ticket.

Show
Mike Wilson added a comment - 19/May/12 12:57 PM This is actually a duplicate of DWR-574 even though that report's title may be misleading. I'm closing as Duplicate anyway, and we can continue the discussion in that ticket.

People

Dates

  • Created:
    17/May/12 4:49 AM
    Updated:
    19/May/12 12:57 PM
    Resolved:
    19/May/12 12:57 PM