Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #12636
| From | Knute Johnson <nospam@knutejohnson.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Strange Socket problem |
| Date | 2012-03-03 17:59 -0800 |
| Organization | A noiseless patient Spider |
| Message-ID | <jiuia6$ktc$2@dont-email.me> (permalink) |
| References | <jiojsa$5ol$1@dont-email.me> <4f512b27$0$26687$65785112@news.neostrada.pl> <jirjpg$rkb$1@news.albasani.net> <jirlma$bfm$1@dont-email.me> <4f51f338$0$1256$65785112@news.neostrada.pl> |
On 3/3/2012 2:32 AM, x wrote: > Knute Johnson pisze: >> On 3/2/2012 3:06 PM, Lew wrote: >>> I agree that the 'thread' variable's scope is wrong - it should be local >>> to 'start()', not an instance member. But at the moment that's not >>> causing any outright harm. >> >> It's so I can start and interrupt the thread from a method call. >> >> The volatiles exist because the methods that access them can be called >> from other threads. I could have synchronized the start() stop() > > Other threads... What are other threads allowed to do ? > You see, I'm really troubled by the public methods: > > public void disconnect() > public void stop() > public boolean isConnected() disconnect() is called by the main class to force a reload of the data stop() is called my the main class exit routines isConnected() is only called by disconnect() at the moment and will probably disappear in the next minor rewrite >> methods but not easily the socket variable in the run() method. I >> thought it was cleaner to just use volatile. > > But, the volatile keyword does not provide any kind of access control. > It just tells the JVM "hey, if this variable is changed by thread A, the > changed value must be visible for thread B, so don't cache it too > aggressively'. > > Marcin Jaskolski I know and I'm only using it for visibility in the methods when called by another class. -- Knute Johnson
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-01 11:49 -0800
Re: Strange Socket problem Steven Simpson <ss@domain.invalid> - 2012-03-01 20:59 +0000
Re: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-01 13:30 -0800
Re: Strange Socket problem Steven Simpson <ss@domain.invalid> - 2012-03-01 22:54 +0000
Re: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-01 16:32 -0800
Re: Strange Socket problem Steven Simpson <ss@domain.invalid> - 2012-03-03 09:08 +0000
Re: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-03 17:48 -0800
Re: Strange Socket problem markspace <-@.> - 2012-03-01 14:08 -0800
Re: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-01 16:48 -0800
Re: Strange Socket problem markspace <-@.> - 2012-03-02 08:33 -0800
Re: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-02 15:29 -0800
Re: Strange Socket problem markspace <-@.> - 2012-03-03 09:33 -0800
Re: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-03 17:55 -0800
Re: Strange Socket problem markspace <-@.> - 2012-03-03 20:06 -0800
Re: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-03 21:02 -0800
Re: Strange Socket problem "John B. Matthews" <nospam@nospam.invalid> - 2012-03-05 00:00 -0500
Re: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-05 09:44 -0800
Re: Strange Socket problem Martin Gregorie <martin@address-in-sig.invalid> - 2012-03-01 22:15 +0000
Re: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-01 16:43 -0800
Re: Strange Socket problem Martin Gregorie <martin@address-in-sig.invalid> - 2012-03-03 02:01 +0000
Reiteration: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-01 16:51 -0800
Re: Reiteration: Strange Socket problem Martin Gregorie <martin@address-in-sig.invalid> - 2012-03-03 02:02 +0000
Re: Strange Socket problem x <x@x.x> - 2012-03-02 21:18 +0100
Re: Strange Socket problem Lew <noone@lewscanon.com> - 2012-03-02 15:06 -0800
Re: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-02 15:38 -0800
Re: Strange Socket problem Lew <noone@lewscanon.com> - 2012-03-02 16:00 -0800
Re: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-02 17:18 -0800
Re: Strange Socket problem Martin Gregorie <martin@address-in-sig.invalid> - 2012-03-03 02:13 +0000
Re: Strange Socket problem Steven Simpson <ss@domain.invalid> - 2012-03-03 08:41 +0000
Re: Strange Socket problem Martin Gregorie <martin@address-in-sig.invalid> - 2012-03-03 18:26 +0000
Re: Strange Socket problem x <x@x.x> - 2012-03-03 11:32 +0100
Re: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-03 17:59 -0800
Re: Strange Socket problem Lew <noone@lewscanon.com> - 2012-03-03 23:21 -0800
Re: Strange Socket problem x <x@x.x> - 2012-03-03 10:59 +0100
Re: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-03 18:08 -0800
Re: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-02 15:33 -0800
Re: Strange Socket problem Paka Small <paka-en@tumia.org> - 2012-03-03 03:32 -0800
Re: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-03 18:00 -0800
Re: Strange Socket problem x <x@x.x> - 2012-03-03 12:45 +0100
Re: Strange Socket problem Knute Johnson <nospam@knutejohnson.com> - 2012-03-03 18:02 -0800
csiph-web