1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| package org.jboss.cache.lock; |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| public class LockStrategyFactory |
16 |
| { |
17 |
| |
18 |
| |
19 |
| |
20 |
| |
21 |
| private static IsolationLevel lockingLevel_ = IsolationLevel.REPEATABLE_READ; |
22 |
| |
23 |
| |
24 |
| |
25 |
| |
26 |
0
| protected LockStrategyFactory()
|
27 |
| { |
28 |
| } |
29 |
| |
30 |
24
| public static LockStrategy getLockStrategy()
|
31 |
| { |
32 |
24
| return getLockStrategy(lockingLevel_);
|
33 |
| } |
34 |
| |
35 |
180142
| public static LockStrategy getLockStrategy(IsolationLevel lockingLevel)
|
36 |
| { |
37 |
| |
38 |
| |
39 |
| |
40 |
180142
| if (lockingLevel == null)
|
41 |
0
| return new LockStrategyNone();
|
42 |
180142
| switch (lockingLevel)
|
43 |
| { |
44 |
12
| case NONE:
|
45 |
12
| return new LockStrategyNone();
|
46 |
24692
| case SERIALIZABLE:
|
47 |
24692
| return new LockStrategySerializable();
|
48 |
42
| case READ_UNCOMMITTED:
|
49 |
42
| return new LockStrategyReadUncommitted();
|
50 |
319
| case READ_COMMITTED:
|
51 |
319
| return new LockStrategyReadCommitted();
|
52 |
155077
| case REPEATABLE_READ:
|
53 |
0
| default:
|
54 |
155077
| return new LockStrategyRepeatableRead();
|
55 |
| } |
56 |
| } |
57 |
| |
58 |
2844
| public static void setIsolationLevel(IsolationLevel level)
|
59 |
| { |
60 |
2844
| lockingLevel_ = level;
|
61 |
| } |
62 |
| |
63 |
| } |