You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bval.apache.org by Mark Struberg <st...@yahoo.de.INVALID> on 2016/10/22 08:59:53 UTC

copy annotations in multithreaded environments

Hi!

Just stumbled across the following code which is not thread safe. Do we need this? 
Or can we assume that this happens in a single thread anyway?

public void addAnnotation(final Annotation annotation) {
this.annotations = ArrayUtils.add(annotations, annotation);
}

LieGrue,
strub

Re: copy annotations in multithreaded environments

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
I assumed so, but was not 100% sure.

LieGrue,
strub


> Am 22.10.2016 um 11:13 schrieb Romain Manni-Bucau <rm...@gmail.com>:
> 
> it is when the model is built so in a thread safe manner (enclosing code),
> no?
> 
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
> 
> 2016-10-22 10:59 GMT+02:00 Mark Struberg <st...@yahoo.de.invalid>:
> 
>> Hi!
>> 
>> Just stumbled across the following code which is not thread safe. Do we
>> need this?
>> Or can we assume that this happens in a single thread anyway?
>> 
>> public void addAnnotation(final Annotation annotation) {
>> this.annotations = ArrayUtils.add(annotations, annotation);
>> }
>> 
>> LieGrue,
>> strub


Re: copy annotations in multithreaded environments

Posted by Romain Manni-Bucau <rm...@gmail.com>.
it is when the model is built so in a thread safe manner (enclosing code),
no?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-10-22 10:59 GMT+02:00 Mark Struberg <st...@yahoo.de.invalid>:

> Hi!
>
> Just stumbled across the following code which is not thread safe. Do we
> need this?
> Or can we assume that this happens in a single thread anyway?
>
> public void addAnnotation(final Annotation annotation) {
> this.annotations = ArrayUtils.add(annotations, annotation);
> }
>
> LieGrue,
> strub