[concurrency-interest] COWList snapshot.
jason_mehrens at hotmail.com
Wed Feb 19 10:12:50 EST 2014
You can use the COWAL copy constructor which has a fast path for COWAL or use the clone method.
> Date: Wed, 19 Feb 2014 18:21:14 +0400
> From: ppozerov at gmail.com
> To: concurrency-interest at cs.oswego.edu
> Subject: [concurrency-interest] COWList snapshot.
> I was a little bit suprized when found that there is no convenient way
> to get snapshot of COW list.
> What I need is to get snapshot of the list (in form of either array or
> List, doesn't matter) and perform several reads on it (index lookups or
> traversals). For this reason I cannot use iterator. Also I would like
> to avoid unnecessary array copying since I'm not going to perform
> writes. So getting internal array appears to be the best way to do that
> from performance perspective. Copying constructor and forEach() method
> already employ this technique in JDK8
> For now there is no way to get that array since all access to it are
> either private or package-scoped. Could something like "List<T>
> snapshot()" be added to COWList API returning unmodifiable wrapper over
> internal array? Or at least getArray() could be made protected so that
> developers can use it on their own risk :-)
> _______________________________________________ Concurrency-interest
> mailing list Concurrency-interest at cs.oswego.edu
More information about the Concurrency-interest