| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.seasar.uruma.desc; |
| 17 | |
|
| 18 | |
import java.util.concurrent.ConcurrentMap; |
| 19 | |
|
| 20 | |
import org.seasar.framework.util.Disposable; |
| 21 | |
import org.seasar.framework.util.DisposableUtil; |
| 22 | |
import org.seasar.framework.util.tiger.CollectionsUtil; |
| 23 | |
import org.seasar.uruma.desc.impl.PartActionDescImpl; |
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | 0 | public class PartActionDescFactory { |
| 31 | |
private static volatile boolean initialized; |
| 32 | |
|
| 33 | 4 | protected static final ConcurrentMap<Class<?>, PartActionDesc> partActionDescs = CollectionsUtil |
| 34 | |
.newConcurrentHashMap(); |
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
public static void initialize() { |
| 40 | 112 | DisposableUtil.add(new Disposable() { |
| 41 | 112 | public void dispose() { |
| 42 | 112 | PartActionDescFactory.dispose(); |
| 43 | 112 | } |
| 44 | |
}); |
| 45 | 112 | initialized = true; |
| 46 | 112 | } |
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | |
|
| 51 | |
public static synchronized void dispose() { |
| 52 | 112 | partActionDescs.clear(); |
| 53 | 112 | initialized = false; |
| 54 | 112 | } |
| 55 | |
|
| 56 | |
|
| 57 | |
|
| 58 | |
|
| 59 | |
|
| 60 | |
|
| 61 | |
|
| 62 | |
|
| 63 | |
public static PartActionDesc getPartActionDesc( |
| 64 | |
final Class<?> partActionClass) { |
| 65 | 224 | if (!initialized) { |
| 66 | 112 | initialize(); |
| 67 | |
} |
| 68 | 224 | PartActionDesc partActionDesc = partActionDescs.get(partActionClass); |
| 69 | 224 | if (partActionDesc == null) { |
| 70 | 112 | partActionDesc = CollectionsUtil.putIfAbsent(partActionDescs, |
| 71 | |
partActionClass, new PartActionDescImpl(partActionClass)); |
| 72 | |
} |
| 73 | 224 | return partActionDesc; |
| 74 | |
} |
| 75 | |
} |