1 | package com.hammurapi.common.concurrent; |
2 | |
3 | import java.util.HashMap; |
4 | import java.util.Map; |
5 | import java.util.concurrent.ExecutorService; |
6 | import java.util.concurrent.locks.ReadWriteLock; |
7 | import java.util.concurrent.locks.ReentrantReadWriteLock; |
8 | |
9 | import com.hammurapi.common.Context; |
10 | import com.hammurapi.convert.Converter; |
11 | |
12 | /** |
13 | * Property set which uses in-memory collections and reentrant read-write lock |
14 | * @author Pavel Vlasov |
15 | * |
16 | * @param <KP> |
17 | * @param <KE> |
18 | */ |
19 | public abstract class LocalAbstractPropertySet<KP, KE> extends AbstractPropertySet<KP, KE> { |
20 | |
21 | private Map<KE, Object> valueStore = new HashMap<KE, Object>(); |
22 | private Map<KE, AbstractPropertySet<KP, KE>> subSetStore = new HashMap<KE, AbstractPropertySet<KP,KE>>(); |
23 | private Map<KE, PropertySet<KP>> mounts = new HashMap<KE, PropertySet<KP>>(); |
24 | |
25 | protected LocalAbstractPropertySet( |
26 | ExecutorService executorService, |
27 | Converter converter, |
28 | // ClassLoader classLoader, |
29 | Context context, |
30 | PropertySet<KP>... shadows) { |
31 | super(executorService, converter, /* classLoader,*/ context, shadows); |
32 | } |
33 | |
34 | @Override |
35 | protected Map<KE, Object> getValueStore() { |
36 | return valueStore; |
37 | } |
38 | |
39 | @Override |
40 | protected Map<KE, AbstractPropertySet<KP, KE>> getSubSetStore() { |
41 | return subSetStore; |
42 | } |
43 | |
44 | @Override |
45 | protected Map<KE, PropertySet<KP>> getMounts() { |
46 | return mounts; |
47 | } |
48 | |
49 | } |