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


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

Re: Concurrent bidirectional one-to-many map?

Path csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: Concurrent bidirectional one-to-many map?
Date Sat, 07 May 2011 09:35:27 -0700
Organization A noiseless patient Spider
Lines 22
Message-ID <iq3scr$j6q$1@dont-email.me> (permalink)
References <iq1kf0$ee2$1@news.albasani.net> <iq1mmc$hbv$1@dont-email.me> <iq348b$iv1$1@news.albasani.net>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Sat, 7 May 2011 16:35:39 +0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="hctok4Oswz+KkDpnDNgbjA"; logging-data="19674"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+R5ESlllYWYLNoePT3MIrpKBvBtEOB4oA="
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
In-Reply-To <iq348b$iv1$1@news.albasani.net>
Cancel-Lock sha1:YLKkuM0gH7/Vd5VAJ+M3EL2dqCM=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3765

Show key headers only | View raw


On 5/7/2011 2:43 AM, Sebastian wrote:

> Now I want to be able to close a workspace, releasing all tasks
> to be assignable again to other workspaces.
>
> public void closeWorkspace( Workspace ws ) {
> // how do this efficiently? iterate over all
> // entries (holding a write lock) and remove it
> // when the value equals ws?
> }


Fundamentally, I don't see any solution other than Patricia's.  And I 
think you'll need to hold locks for atomicity over all structures 
anyway: I can't think of a different way of doing it.  Unless your 
problem can somehow tolerate finding a task as it's workspace is being 
closed, you'll have to guarantee that all operations complete before the 
next one is processed.

It really does depend on what "efficiently" means here.  I'd just use 
locks and let the JVM optimize it.  It's pretty good at that.

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


Thread

Concurrent bidirectional one-to-many map? Sebastian <sebastian@undisclosed.invalid> - 2011-05-06 22:07 +0200
  Re: Concurrent bidirectional one-to-many map? markspace <-@.> - 2011-05-06 13:45 -0700
    Re: Concurrent bidirectional one-to-many map? Sebastian <sebastian@undisclosed.invalid> - 2011-05-07 11:43 +0200
      Re: Concurrent bidirectional one-to-many map? Lew <noone@lewscanon.com> - 2011-05-07 07:59 -0400
        Re: Concurrent bidirectional one-to-many map? Lew <noone@lewscanon.com> - 2011-05-07 12:49 -0400
          Re: Concurrent bidirectional one-to-many map? Sebastian <sebastian@undisclosed.invalid> - 2011-05-07 21:34 +0200
      Re: Concurrent bidirectional one-to-many map? Patricia Shanahan <pats@acm.org> - 2011-05-07 06:40 -0700
        Re: Concurrent bidirectional one-to-many map? Tom Anderson <twic@urchin.earth.li> - 2011-05-08 04:51 +0100
          Re: Concurrent bidirectional one-to-many map? Robert Klemme <shortcutter@googlemail.com> - 2011-05-09 06:43 -0700
            Re: Concurrent bidirectional one-to-many map? Tom Anderson <twic@urchin.earth.li> - 2011-05-09 18:28 +0100
              Re: Concurrent bidirectional one-to-many map? Sebastian <sebastian@undisclosed.invalid> - 2011-05-09 22:57 +0200
                Re: Concurrent bidirectional one-to-many map? Lew <noone@lewscanon.com> - 2011-05-09 18:36 -0400
                Re: Concurrent bidirectional one-to-many map? Tom Anderson <twic@urchin.earth.li> - 2011-05-10 08:34 +0100
                Re: Concurrent bidirectional one-to-many map? Sebastian <sebastian@undisclosed.invalid> - 2011-05-11 10:09 +0200
                Re: Concurrent bidirectional one-to-many map? Sebastian <sebastian@undisclosed.invalid> - 2011-05-11 10:51 +0200
                Re: Concurrent bidirectional one-to-many map? Robert Klemme <shortcutter@googlemail.com> - 2011-05-11 04:55 -0700
                Re: Concurrent bidirectional one-to-many map? Lew <noone@lewscanon.com> - 2011-05-11 09:00 -0400
                Re: Concurrent bidirectional one-to-many map? Sebastian <sebastian@undisclosed.invalid> - 2011-05-11 20:47 +0200
      Re: Concurrent bidirectional one-to-many map? markspace <-@.> - 2011-05-07 09:35 -0700
      Re: Concurrent bidirectional one-to-many map? Michal Kleczek <kleku75@gmail.com> - 2011-05-09 16:42 +0200
  Re: Concurrent bidirectional one-to-many map? Roedy Green <see_website@mindprod.com.invalid> - 2011-05-07 03:46 -0700

csiph-web