KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > perseus > concurrency > distributed > globallock > api > GlobalLockWaiter


1 /**
2  * Copyright (C) 2003-2004
3  * - France Telecom R&D
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Release: 1.0
20  *
21  * Authors: Olivier Lobry (olivier.lobry@francetelecom.com)
22  * Date: 15 juin 2004
23  * Time: 17:54:11
24  */

25
26 package org.objectweb.perseus.concurrency.distributed.globallock.api;
27
28
29 /**
30  * This interface is used to sychronize with lock requests in asynchronous mode.
31  * It is returned by the <code>upgrade</code> method of the
32  * <code>GlobalLock</code> interface. This can be used to ensure FIFO handling
33  * of requests when implementing multilevel lock management.
34  * @see GlobalLock
35  */

36
37 public interface GlobalLockWaiter {
38
39     /**
40      * Wait until the lock is granted or refused.
41      * @param timeout max time to wait
42      * @return true if the lock is granted, false if refused
43      * @throws InterruptedException if the thread has been interrupted
44      */

45     boolean waitLock(long timeout) throws InterruptedException JavaDoc;
46
47
48     /**
49      * Signal that the lock granting has been handled by the waiter and that
50      * next waiters can have their requests granted if possible
51      */

52     void signalHandled();
53
54     /**
55      * Get the requested lock level
56      * @return the requested lock level
57      */

58     byte getLockLevel();
59
60 }
61
Popular Tags