• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

alibaba / jetcache / #444

21 May 2026 07:54AM UTC coverage: 89.292% (+0.6%) from 88.701%
#444

push

areyouok
chore: remove Spring XML namespace support

4778 of 5351 relevant lines covered (89.29%)

0.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

69.7
/jetcache-core/src/main/java/com/alicp/jetcache/support/DecoderMap.java
1
/**
2
 * Created on 2018/3/20.
3
 */
4
package com.alicp.jetcache.support;
5

6
import com.alicp.jetcache.anno.SerialPolicy;
7

8
import java.util.concurrent.ConcurrentHashMap;
9
import java.util.concurrent.locks.ReentrantLock;
10

11
/**
12
 * @author huangli
13
 */
14
public class DecoderMap {
15

16
    private final ConcurrentHashMap<Integer, AbstractValueDecoder> decoderMap = new ConcurrentHashMap<>();
1✔
17
    private volatile boolean inited = false;
1✔
18
    private final ReentrantLock reentrantLock = new ReentrantLock();
1✔
19

20
    private static final DecoderMap instance = new DecoderMap();
1✔
21

22
    public DecoderMap() {
1✔
23
    }
1✔
24

25
    public static DecoderMap defaultInstance() {
26
        return instance;
1✔
27
    }
28

29
    public AbstractValueDecoder getDecoder(int identityNumber) {
30
        return decoderMap.get(identityNumber);
1✔
31
    }
32

33
    public void register(int identityNumber, AbstractValueDecoder decoder) {
34
        decoderMap.put(identityNumber, decoder);
1✔
35
    }
1✔
36

37
    public void clear() {
38
        decoderMap.clear();
×
39
    }
×
40

41
    public ReentrantLock getLock() {
42
        return reentrantLock;
×
43
    }
44

45
    public void setInited(boolean inited) {
46
        this.inited = inited;
×
47
    }
×
48

49
    public void initDefaultDecoder() {
50
        if (inited) {
1✔
51
            return;
1✔
52
        }
53
        reentrantLock.lock();
1✔
54
        try {
55
            if (inited) {
1✔
56
                return;
×
57
            }
58
            register(SerialPolicy.IDENTITY_NUMBER_JAVA, defaultJavaValueDecoder());
1✔
59
            try {
60
                Class.forName("com.esotericsoftware.kryo.kryo5.Kryo");
1✔
61
                register(SerialPolicy.IDENTITY_NUMBER_KRYO5, Kryo5ValueDecoder.INSTANCE);
1✔
62
            } catch (ClassNotFoundException e) {
×
63
                // the com.esotericsoftware:kryo should be 5+
64
                register(SerialPolicy.IDENTITY_NUMBER_KRYO5, KryoValueDecoder.INSTANCE);
×
65
            }
1✔
66
            // register(SerialPolicy.IDENTITY_NUMBER_FASTJSON2, Fastjson2ValueDecoder.INSTANCE);
67
            inited = true;
1✔
68
        } finally {
69
            reentrantLock.unlock();
1✔
70
        }
71
    }
1✔
72

73
    public static JavaValueDecoder defaultJavaValueDecoder() {
74
        try {
75
            Class.forName("org.springframework.core.ConfigurableObjectInputStream");
1✔
76
            return SpringJavaValueDecoder.INSTANCE;
1✔
77
        } catch (ClassNotFoundException e) {
×
78
            return JavaValueDecoder.INSTANCE;
×
79
        }
80
    }
81

82

83
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc