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


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

Re: Concurrent bidirectional one-to-many map?

From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Concurrent bidirectional one-to-many map?
Date 2011-05-11 04:55 -0700
Organization http://groups.google.com
Message-ID <d5e1219d-70bd-4171-ad5d-337c6b15a84b@e35g2000yqc.googlegroups.com> (permalink)
References (6 earlier) <alpine.DEB.2.00.1105091825310.18864@urchin.earth.li> <iq9kf7$fr1$1@news.albasani.net> <alpine.DEB.2.00.1105100824001.25309@urchin.earth.li> <iqdg8g$aao$1@news.albasani.net> <iqdinb$fjv$1@news.albasani.net>

Show all headers | View raw


On 11 Mai, 10:51, Sebastian <sebast...@undisclosed.invalid> wrote:
> Am 11.05.2011 10:09, schrieb Sebastian:
>
>
>
> > Here's a bit of the WorkspaceManager code referred to above:
>
> > public void closeWorkspace( UUID id )
> > {
> >   writeLock.lock(); // <<<<<<<<<<< necessary ?
> >   try {
> >    Workspace wp = wpMap.remove( id );
> > ...
>
> As afterthought to my immediately preceding post,
> let me add that it would be nice if we could process
> unrelated workspaces in parallel. How about having a
> ReentrantReadWriteLock associated with each workspace,
> and using  themlike this:
>
>    Workspace wp = wpMap.get( id );
>    wp.writeLock.lock();
>    try {
>      wpMap.remove( id );
>      ...
>
> Wouldn't this improve things?

You said you can't modify Workspace and Task.  If you create wrapper
classes then you need synchronization when managing the mapping from
original to wrapped.  Sorry, I don't have time to go into more detail,
but externally adding state in a thread safe but still scalable manner
is tricky (unless you code Ruby that is ;-)).

Cheers

robert

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