KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > rift > coad > util > lock > LockRef


1 /*
2  * CoadunationUtil: The coaduntion utility library.
3  * Copyright (C) 2006 Rift IT Contracting
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.1 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * LockRef.java
20  */

21
22 // the package path
23
package com.rift.coad.util.lock;
24
25 /**
26  * This interface provides access to the lock.
27  *
28  * @author Brett Chaldecott
29  */

30 public interface LockRef {
31     // class constants
32
public final static int READ = 1;
33     public final static int WRITE = 2;
34     
35     /**
36      * This method returns the key that the lock has been created for.
37      *
38      * @return The key the lock has been created for.
39      */

40     public Object JavaDoc getKey();
41     
42     
43     /**
44      * This method returns the id of the thread locking this object.
45      *
46      * @return The id of the thread that has the lock.
47      */

48     public long getThreadId() throws LockException;
49     
50     
51     /**
52      * This method sets the thread id for the lock.
53      *
54      * @param id The new thread id.
55      */

56     public void setThreadId(long id) throws LockException;
57     
58     
59     /**
60      * This method returns the name of the lock for the key.
61      *
62      * @return The string containing the name of the lock.
63      */

64     public Object JavaDoc getLockName() throws LockException;
65     
66     
67     /**
68      * This method sets the name associated with the key lock.
69      *
70      * @param name The name of the lock.
71      */

72     public void setLockName(Object JavaDoc name) throws LockException;
73     
74     
75     /**
76      * This method returns the lock type for this object.
77      *
78      * @return The lock type for this object.
79      * @exception LockException
80      */

81     public int getLockType() throws LockException;
82     
83     
84     /**
85      * This method releases the lock.
86      */

87     public void release() throws LockException;
88 }
89
Popular Tags