ContextMap.java
1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* Decompiled with CFR 0_118.
*/
package com.day.commons.simplejndi.impl;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.naming.NamingException;
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
public class ContextMap {
private static ContextMap instance = new ContextMap();
private Map<String, Object> sharedMap = new HashMap<String, Object>();
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public void bind(String key, Object value) throws NamingException {
if (key == null) {
throw new NamingException();
}
Map<String, Object> map = this.sharedMap;
synchronized (map) {
this.sharedMap.put(key, value);
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public void unbind(String key) {
Map<String, Object> map = this.sharedMap;
synchronized (map) {
if (this.sharedMap.containsKey(key)) {
this.sharedMap.remove(key);
}
}
}
public Map<String, Object> getBindings() {
return Collections.unmodifiableMap(this.sharedMap);
}
public static ContextMap getInstance() {
return instance;
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
void clear() {
Map<String, Object> map = this.sharedMap;
synchronized (map) {
this.sharedMap.clear();
}
}
}