Return-Path: Mailing-List: contact lucene-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list lucene-dev@jakarta.apache.org Received: (qmail 57878 invoked from network); 12 Aug 2003 15:02:56 -0000 Received: from etapestry-colo-32-2.onecall.net (HELO darth?bobo.etapestry.com) (216.37.32.2) by daedalus.apache.org with SMTP; 12 Aug 2003 15:02:56 -0000 Received: from etapestry.com (192.168.1.103 [192.168.1.103]) by darth_bobo.etapestry.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id 3X7ZJX9X; Tue, 12 Aug 2003 10:04:30 -0500 Message-ID: <3F390198.1030203@etapestry.com> Date: Tue, 12 Aug 2003 10:02:48 -0500 From: Scott Ganyo User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030630 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Lucene Developers List Subject: Re: Adding lock timeouts to write.lock References: <3F340378.3020301@etapestry.com> In-Reply-To: <3F340378.3020301@etapestry.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Ok, I know I said I'd check in Wednesday, but as it turns out I'm going to be out Wednesday. So, as there has only been positive feedback, I'm just going to go ahead and commit now. Scott Scott Ganyo wrote: > As suggested in previous emails, I have implemented the ability to > wait on any kind of lock. I've attached the diffs, but here are the > highlights: > > 1) added the following statics to Lock: > > public static long WRITE_LOCK_TIMEOUT = 1000; > public static long COMMIT_LOCK_TIMEOUT = 10000; > public static long LOCK_POLL_INTERVAL = 1000; > > 2) added the following method to Lock: > > /** Attempt to obtain an exclusive lock within amount > * of time given. Currently polls once per second until > * lockWaitTimeout is passed. > * @param lockWaitTimeout length of time to wait in ms > * @return true if lock was obtained > * @throws IOException if lock wait times out or obtain() throws an > IOException > */ > public boolean obtain(long lockWaitTimeout) throws IOException > > 3) added the following method to Lock.With: > > /** Constructs an executor that will grab the named lock. */ > public With(Lock lock, long lockWaitTimeout) > > 4) cleaned up Lock.With to use the new obtain(long) method on Lock. > > 5) changed callers obtaining "write.lock" to pass Lock.WRITE_LOCK_TIMEOUT > > 6) changed callers obtaining "commit.lock" to pass > Lock.COMMIT_LOCK_TIMEOUT > > The net effect is to expose the timeout and change the write.lock to > have a 1 second timeout as a default instead of immediately throwing > an IOException. > > So that there can be a review and comment period, I won't plan to > check it in Wednesday of next week. > > Scott