Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Concurrent bidirectional one-to-many map? Date: Wed, 11 May 2011 09:00:23 -0400 Organization: albasani.net Lines: 39 Message-ID: References: <08586289-8935-4532-93d0-e8c7dd45cb24@c1g2000yqe.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net OffCsC8ERCav7B5i5LyUeJkgs03M40jaJhbvd1dbAYQSXZftpKk/reuvx+L777ST84eDCzEmGPiEdGfZHfTovdo069bceBBniTnCB6QN6KLWk6h2YM8S/wc3Aayp9v5i NNTP-Posting-Date: Wed, 11 May 2011 13:00:22 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="XatB/8ASZJMCbiCxi62gIW6xrAj5TEFZyqgs5J7OlFU3upECQ0NC7YqU1bMDKJ9NHAev+/++tNpTmxobv0n2Y9VeN4zrN3Atm4OhOI6bUJx3DYS3Hztm8lDbofNL/afV"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 In-Reply-To: Cancel-Lock: sha1:235Es3HQxrpDfdn2CB9J/sVlyOo= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3968 On 05/11/2011 04:51 AM, Sebastian 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? Why have you never answered my questions about long locks? You seem to be going through a lot of gyrations unnecessarily. Just lock the data you need to lock. It's kind of rude that you ask for help but don't respond to requests for further information. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg