- public static QName create(String name){
- QName value = cache.get(name);
- if(value == null){
- synchronized (cache){
- value = cache.get(name);
- if(value == null) {
- value = QName.create(name);
- cache.put(name, value);
+ private static final int MAX_QNAME_CACHE_SIZE = 10000;
+
+ private static final LoadingCache<String, QName> CACHE = CacheBuilder.newBuilder()
+ .maximumSize(MAX_QNAME_CACHE_SIZE)
+ .softValues()
+ .build(
+ new CacheLoader<String, QName>() {
+ @Override
+ public QName load(String key) {
+ return QName.create(key);