Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #2934

Re: Threads and statics

From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Threads and statics
Date 2011-04-07 07:38 -0700
Organization http://groups.google.com
Message-ID <e325cb5e-ca0a-4d8b-b865-1f5a5b06811e@x1g2000yqb.googlegroups.com> (permalink)
References <905p9gFpuoU1@mid.individual.net> <_8udnYBYP_NkLQDQnZ2dnUVZ_gGdnZ2d@earthlink.com>

Show all headers | View raw


On 7 Apr., 14:41, Patricia Shanahan <p...@acm.org> 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.

Kind regards

robert

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Threads and statics Dirk Bruere at NeoPax <dirk.bruere@gmail.com> - 2011-04-07 13:34 +0100
  Re: Threads and statics Patricia Shanahan <pats@acm.org> - 2011-04-07 05:41 -0700
    Re: Threads and statics Robert Klemme <shortcutter@googlemail.com> - 2011-04-07 07:38 -0700
      Re: Threads and statics Lew <lew@lewscanon.com> - 2011-04-07 08:20 -0700
        Re: Threads and statics Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-04-07 18:47 -0300
  Re: Threads and statics markspace <-@.> - 2011-04-07 09:32 -0700
  Re: Threads and statics Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-04-07 21:14 -0400
    Re: Threads and statics Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2011-04-09 18:15 +0200
      Re: Threads and statics Lew <noone@lewscanon.com> - 2011-04-09 13:06 -0400
    Re: Threads and statics Patricia Shanahan <pats@acm.org> - 2011-04-09 09:29 -0700
    Re: Threads and statics Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-04-09 09:29 -0700
    Re: Threads and statics Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-04-09 14:57 -0400
      Re: Threads and statics "Mike Schilling" <mscottschilling@hotmail.com> - 2011-04-10 23:10 -0700
        Re: Threads and statics Tom Anderson <twic@urchin.earth.li> - 2011-04-11 13:25 +0100
          Re: Threads and statics Lew <noone@lewscanon.com> - 2011-04-11 08:58 -0400

csiph-web