KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > transaction > memory > jca > MemoryMapResourceManager


1 /*
2  * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//transaction/src/java/org/apache/commons/transaction/memory/jca/MemoryMapResourceManager.java,v 1.1 2004/11/18 23:27:18 ozeigermann Exp $
3 <<<<<<< .mine
4  * $Revision: 1.1 $
5  * $Date: 2005-02-26 14:16:14 +0100 (Sa, 26 Feb 2005) $
6 =======
7  * $Revision$
8  * $Date: 2005-02-26 14:16:14 +0100 (Sa, 26 Feb 2005) $
9 >>>>>>> .r168169
10  *
11  * ====================================================================
12  *
13  * Copyright 1999-2002 The Apache Software Foundation
14  *
15  * Licensed under the Apache License, Version 2.0 (the "License");
16  * you may not use this file except in compliance with the License.
17  * You may obtain a copy of the License at
18  *
19  * http://www.apache.org/licenses/LICENSE-2.0
20  *
21  * Unless required by applicable law or agreed to in writing, software
22  * distributed under the License is distributed on an "AS IS" BASIS,
23  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24  * See the License for the specific language governing permissions and
25  * limitations under the License.
26  *
27  */

28
29 package org.apache.commons.transaction.memory.jca;
30
31 import java.util.HashMap JavaDoc;
32 import java.util.Map JavaDoc;
33
34 import org.apache.commons.transaction.memory.TransactionalMapWrapper;
35
36 /**
37  *
38  * @version $Revision$
39  *
40  */

41 public class MemoryMapResourceManager {
42
43     protected static MemoryMapResourceManager instance = new MemoryMapResourceManager();
44
45     public static MemoryMapResourceManager getInstance() {
46         return instance;
47     }
48
49     protected Map JavaDoc maps = new HashMap JavaDoc();
50
51     public synchronized TransactionalMapWrapper lookup(Object JavaDoc id) {
52
53         TransactionalMapWrapper map = (TransactionalMapWrapper) maps.get(id);
54         // XXX simply create it when not there
55
if (map == null) {
56             map = new TransactionalMapWrapper(new HashMap JavaDoc());
57             maps.put(id, map);
58         }
59
60         return map;
61     }
62 }
63
Popular Tags