dev@jersey.java.net

Re: [Jersey] com.sun.jersey.core.util.MultivalueMapImpl.getList: should be synchronized?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 11 May 2009 21:40:12 +0200

On May 11, 2009, at 9:15 PM, Paul C. Bryan wrote:

> I'm thinking that the MultivalueMapImpl.getList method -- since it
> exercises lazy initialization of the list -- should be synchronized.
> Make sense?
>

No, because it is not designed to be a concurrent implementation. I do
not recall there being a place in Jersey where an instance of
MultivalueMapImpl is modified concurrently.

I think the right thing to do is, if one requires an instance to be
modified concurrently, to have a ConcurrentMultivaluedMapImpl
implementation that adapts an instance of MultivaluedMap, which is
similar to how the Java collections framework is designed.

Paul.