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


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

Re: data shared between threads and synchronized on different objects

From Tom Anderson <twic@urchin.earth.li>
Newsgroups comp.lang.java.programmer
Subject Re: data shared between threads and synchronized on different objects
Date 2011-08-03 18:27 +0100
Organization Stack Usenet News Service
Message-ID <alpine.DEB.2.00.1108031826270.12590@urchin.earth.li> (permalink)
References <61899466-4def-4982-8aa9-b789aeead3ad@m22g2000yqh.googlegroups.com> <alpine.DEB.2.00.1108022226470.8354@urchin.earth.li> <j19s56$n8s$1@dont-email.me> <alpine.DEB.2.00.1108031429350.32653@urchin.earth.li> <JcidnZWeTfvu96TTnZ2dnUVZ_judnZ2d@earthlink.com>

Show all headers | View raw


On Wed, 3 Aug 2011, Patricia Shanahan wrote:

> On 8/3/2011 6:29 AM, Tom Anderson wrote:
>> On Tue, 2 Aug 2011, markspace wrote:
>> 
>>> On 8/2/2011 2:41 PM, Tom Anderson wrote:
>>>> On Tue, 2 Aug 2011, Marcin Rodzik wrote:
>>>> 
>>>>> I have a thread (the essential piece of its code can be found here:
>>>>> http://pastebin.com/KM8Yiqgs) which sends some objects ("tasks") over
>>>>> the network (in method tryToSendTask). Another thread submits objects
>>>>> to be sent by means of the first thread's method submit - namely, the
>>>>> "task" is put into queue.
>>>>> 
>>>>> [...]
>>>>> 
>>>>> What do you think?
>>>> 
>>>> I think you can make this a good bit simpler by using a BlockingQueue,
>>> 
>>> That's funny. Marcin (Marteno?) posted this same question twice. I
>>> basically told him the exact same thing 6 hours ago, sans the nice
>>> code example.
>> 
>> How embarrassing. I must pay more attention to what's going on around here.
>
> Maybe duplicate, independent recommendations for the same solution will
> encourage the OP to look at it.

True. Although really, someone who repeat-posts mostly needs encouraging 
not to do that.

Also, the OP has no way of knowing that i hadn't just read Mark's answer 
and added some more curly brackets to it!

tom

-- 
Swords not words!

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


Thread

data shared between threads and synchronized on different objects Marcin Rodzik <marteno_rodia@o2.pl> - 2011-08-02 07:53 -0700
  Re: data shared between threads and synchronized on different objects Tom Anderson <twic@urchin.earth.li> - 2011-08-02 22:41 +0100
    Re: data shared between threads and synchronized on different objects markspace <-@.> - 2011-08-02 15:02 -0700
      Re: data shared between threads and synchronized on different objects Tom Anderson <twic@urchin.earth.li> - 2011-08-03 14:29 +0100
        Re: data shared between threads and synchronized on different objects Patricia Shanahan <pats@acm.org> - 2011-08-03 08:34 -0700
          Re: data shared between threads and synchronized on different objects Tom Anderson <twic@urchin.earth.li> - 2011-08-03 18:27 +0100
            Re: data shared between threads and synchronized on different objects supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-08-03 23:24 -0400

csiph-web