Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: A quota based lock Date: Mon, 08 Aug 2011 07:58:11 -0700 Organization: A noiseless patient Spider Lines: 22 Message-ID: References: <83f81158-8aee-486d-a51b-c0f7dfdbb0da@h25g2000prf.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 8 Aug 2011 14:58:18 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="XjIWM99mD7Ijfdu600oVPA"; logging-data="4847"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/OoJQDFvkaD4gWpULRbXWsumxDHIPd0TI=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 In-Reply-To: <83f81158-8aee-486d-a51b-c0f7dfdbb0da@h25g2000prf.googlegroups.com> Cancel-Lock: sha1:gtpDzPYf//Peyg22wWv3WfZ+074= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6868 On 8/8/2011 12:13 AM, Robert Stark wrote: > I want to write a lock to control access to a resource, there are > different kind of jobs using this resource, say job A,B,C, at the > beginning, i use Lock api from jdk concurrent package, but i suffered > from serious job starvation, so i want to do something like this: I got to agree with Eric: I don't think the problem specification is clear. Could you show, in a short code example, how the problem currently occurs? Make a couple of jobs and show how one gets "starved?" See SSCCE: If you have limited resources, I don't see how changing the lock system will help. Limited resources mean some jobs might get starved if other jobs hog the resources. I think an example of how the current system is working my help us understand better why you think there's room for improvement.