Since it wasn’t designed to be used in a multi-threaded test it would be a mistake to do that. I don’t know that I have written any multi-threaded tests that use it.
Ralph > On Sep 15, 2016, at 12:25 PM, Gary Gregory <[email protected]> wrote: > > Well, that was my initial question. Since we use ListAppender all over our > tests, ARE WE in fact using it from IN ANY multithreaded manner? I do not > know. If we are, then we might be getting lucky. I do not know. > > Gary > > On Thu, Sep 15, 2016 at 12:17 PM, Ralph Goers <[email protected] > <mailto:[email protected]>> wrote: > Why are we even talking about this. Does someone really have a use case > where they want to use the ListAppender in a multithreaded manner in a unit > test? > > Ralph > >> On Sep 15, 2016, at 12:13 PM, Gary Gregory <[email protected] >> <mailto:[email protected]>> wrote: >> >> I'm not sure why. Probably because we want our test code to be more like >> production code since tests show _how_ to use Log4j for some people. So we >> might as well do it in a way that is best. It seems that Java has a lot of >> concurrent classes that are designed to work better that a brute-force >> synchronous wrapper around a list. >> >> Gary >> >> On Thu, Sep 15, 2016 at 2:44 AM, Mikael Ståldal <[email protected] >> <mailto:[email protected]>> wrote: >> Why not a synchronized list? The performance might not be optimal, but >> probably be OK for unit tests. >> >> On Thu, Sep 8, 2016 at 10:34 PM, Gary Gregory <[email protected] >> <mailto:[email protected]>> wrote: >> Should ListAppender use CopyOnWriteArray instead of ArrayList? Either all >> the time or when using in aync tests? >> >> Gary >> >> -- >> E-Mail: [email protected] <mailto:[email protected]> | >> [email protected] <mailto:[email protected]> >> Java Persistence with Hibernate, Second Edition >> <http://www.manning.com/bauer3/> >> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> >> Spring Batch in Action <http://www.manning.com/templier/> >> Blog: http://garygregory.wordpress.com <http://garygregory.wordpress.com/> >> Home: http://garygregory.com/ <http://garygregory.com/> >> Tweet! http://twitter.com/GaryGregory <http://twitter.com/GaryGregory> >> >> >> -- >> >> >> Mikael Ståldal >> Senior software developer >> >> Magine TV >> [email protected] <mailto:[email protected]> >> Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com >> <http://www.magine.com/> >> >> Privileged and/or Confidential Information may be contained in this message. >> If you are not the addressee indicated in this message >> (or responsible for delivery of the message to such a person), you may not >> copy or deliver this message to anyone. In such case, >> you should destroy this message and kindly notify the sender by reply email. >> >> >> >> >> -- >> E-Mail: [email protected] <mailto:[email protected]> | >> [email protected] <mailto:[email protected]> >> Java Persistence with Hibernate, Second Edition >> <http://www.manning.com/bauer3/> >> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> >> Spring Batch in Action <http://www.manning.com/templier/> >> Blog: http://garygregory.wordpress.com <http://garygregory.wordpress.com/> >> Home: http://garygregory.com/ <http://garygregory.com/> >> Tweet! http://twitter.com/GaryGregory <http://twitter.com/GaryGregory> > > > > -- > E-Mail: [email protected] <mailto:[email protected]> | > [email protected] <mailto:[email protected]> > Java Persistence with Hibernate, Second Edition > <http://www.manning.com/bauer3/> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> > Spring Batch in Action <http://www.manning.com/templier/> > Blog: http://garygregory.wordpress.com <http://garygregory.wordpress.com/> > Home: http://garygregory.com/ <http://garygregory.com/> > Tweet! http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>
