On Thu, Jan 26, 2017 at 7:31 AM, Felix Schumacher <
[email protected]> wrote:

>
>
> Am 25. Januar 2017 23:28:48 MEZ schrieb Philippe Mouawad <
> [email protected]>:
> >Hello,
> >There was a similar synchro bug in those 3 classes as reported in:
> >
> >   - https://bz.apache.org/bugzilla/show_bug.cgi?id=60648
> >
> >CopyOnWriteArrayList does not seem to be a good option.
> >
> >I fixed them with regular Synchronization but I wonder if there is not
> >a
> >better way using Java 8.
>
> Would a ConcurrentLinkedQueue fit your need?
>
Possibly, but I don't see how I can atomically remove all elements from it
to a new object I would use in writeAndSendMetrics.
Or maybe there's another way I don't see.
Thanks anyway

>
> Felix
>
> >
> >But I am not sure.
> >
> >I read this:
> >
> >-
> >http://blog.takipi.com/java-8-stampedlocks-vs-readwritelocks-and-
> synchronized/
> >-
> >https://docs.oracle.com/javase/8/docs/technotes/
> guides/concurrency/changes8.html
> >
> >My intention was to have a thread safe collections (without using
> >Collections.synchronized...) and have a method to atomically "drain"
> >rows
> >from the list in a local variable , this way synchro would not have
> >been
> >needed.
> >
> >
> >Is there a way through streams to do that  ?
> >Sorry for my stupid questions.
> >Thanks for help
> >Regards
>



-- 
Cordialement.
Philippe Mouawad.

Reply via email to