1 package locklib.mutex;
2
3 import locklib.LockPolicy;
4 import ensure.Ensure;
5
6
7
8
9
10 public class MutexLockPolicy implements LockPolicy<MutexLockType> {
11
12
13
14 public MutexLockPolicy() {
15 }
16
17 @Override
18 public boolean is_compatible(MutexLockType lock_type_1,
19 MutexLockType lock_type_2) {
20 Ensure.not_null(lock_type_1, "lock_type_1 == null");
21 Ensure.not_null(lock_type_2, "lock_type_2 == null");
22
23 return false;
24 }
25
26 @Override
27 public MutexLockType parent_lock(MutexLockType lock_type) {
28 Ensure.not_null(lock_type, "lock_type == null");
29
30 return lock_type;
31 }
32
33 @Override
34 public boolean starvation_allowed() {
35 return false;
36 }
37 }