Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!nx02.iad01.newshosting.com!newshosting.com!69.16.185.16.MISMATCH!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe03.iad.POSTED!8ad76e89!not-for-mail From: Arved Sandstrom User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: Threads and statics References: <905p9gFpuoU1@mid.individual.net> <_8udnYBYP_NkLQDQnZ2dnUVZ_gGdnZ2d@earthlink.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Lines: 47 Message-ID: X-Complaints-To: abuse@newsgroups-download.com NNTP-Posting-Date: Thu, 07 Apr 2011 21:47:29 UTC Organization: Public Usenet Newsgroup Access Date: Thu, 07 Apr 2011 18:47:28 -0300 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:2948 On 11-04-07 12:20 PM, Lew wrote: > On Apr 7, 10:38 am, Robert Klemme wrote: >> On 7 Apr., 14:41, Patricia Shanahan wrote: >> >>> On 4/7/2011 5:34 AM, Dirk Bruere at NeoPax wrote: >> >>>> Is there a problem with multiple threads using the same static method of >>>> a class? >> >>> The local variables for a method go on the calling thread's stack, >>> regardless of whether the method is static or not. >> >>> Static data presents the same issues when accessed from a static method >>> as when accessed from non-static methods. >> >> I would word it differently: shared mutable state presents concurrency >> issues if not properly synchronized. Whether the data is stored in a >> static variable or a member variable (or even a database outside the >> JVM) does not really matter for the concurrency implications. >> > > You'd be wording a different "it". The problems go beyond concurrency > issues. They can present in single-threaded code, too. > > For example, the dreaded 'java.util.ConcurrentModificationException' > is not limited to multithreaded scenarios. > -- > Lew It's not, and in fact most occurrences of ConcurrentModificationException I've seen are not in multi-threaded situations, they are in single-threaded scenarios. I sort of wish they'd come up with a different name than ConcurrentModificationException; the exception usually has to do with iterators in the presence of modification of the iterated thing, and the name of the exception doesn't reflect that. If I don't have iterators involved I can concurrently modify to my heart's content (although I probably don't want to). AHS -- That's not the recollection that I recall...All this information is certainly in the hands of the auditor and we certainly await his report to indicate what he deems has occurred. -- Halifax, Nova Scotia mayor Peter Kelly, who is currently deeply in the shit