|
|
|
@ -114,18 +114,12 @@ public class DefaultContextCache implements ContextCache { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean contains(MergedContextConfiguration key) { |
|
|
|
public boolean contains(MergedContextConfiguration key) { |
|
|
|
Assert.notNull(key, "Key must not be null"); |
|
|
|
Assert.notNull(key, "Key must not be null"); |
|
|
|
return this.contextMap.containsKey(key); |
|
|
|
return this.contextMap.containsKey(key); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
public ApplicationContext get(MergedContextConfiguration key) { |
|
|
|
public ApplicationContext get(MergedContextConfiguration key) { |
|
|
|
@ -140,9 +134,6 @@ public class DefaultContextCache implements ContextCache { |
|
|
|
return context; |
|
|
|
return context; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void put(MergedContextConfiguration key, ApplicationContext context) { |
|
|
|
public void put(MergedContextConfiguration key, ApplicationContext context) { |
|
|
|
Assert.notNull(key, "Key must not be null"); |
|
|
|
Assert.notNull(key, "Key must not be null"); |
|
|
|
@ -159,9 +150,6 @@ public class DefaultContextCache implements ContextCache { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void remove(MergedContextConfiguration key, @Nullable HierarchyMode hierarchyMode) { |
|
|
|
public void remove(MergedContextConfiguration key, @Nullable HierarchyMode hierarchyMode) { |
|
|
|
Assert.notNull(key, "Key must not be null"); |
|
|
|
Assert.notNull(key, "Key must not be null"); |
|
|
|
@ -218,26 +206,17 @@ public class DefaultContextCache implements ContextCache { |
|
|
|
removedContexts.add(key); |
|
|
|
removedContexts.add(key); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public int getFailureCount(MergedContextConfiguration key) { |
|
|
|
public int getFailureCount(MergedContextConfiguration key) { |
|
|
|
return this.failureCounts.getOrDefault(key, 0); |
|
|
|
return this.failureCounts.getOrDefault(key, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void incrementFailureCount(MergedContextConfiguration key) { |
|
|
|
public void incrementFailureCount(MergedContextConfiguration key) { |
|
|
|
this.totalFailureCount.incrementAndGet(); |
|
|
|
this.totalFailureCount.incrementAndGet(); |
|
|
|
this.failureCounts.merge(key, 1, Integer::sum); |
|
|
|
this.failureCounts.merge(key, 1, Integer::sum); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public int size() { |
|
|
|
public int size() { |
|
|
|
return this.contextMap.size(); |
|
|
|
return this.contextMap.size(); |
|
|
|
@ -250,33 +229,21 @@ public class DefaultContextCache implements ContextCache { |
|
|
|
return this.maxSize; |
|
|
|
return this.maxSize; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public int getParentContextCount() { |
|
|
|
public int getParentContextCount() { |
|
|
|
return this.hierarchyMap.size(); |
|
|
|
return this.hierarchyMap.size(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public int getHitCount() { |
|
|
|
public int getHitCount() { |
|
|
|
return this.hitCount.get(); |
|
|
|
return this.hitCount.get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public int getMissCount() { |
|
|
|
public int getMissCount() { |
|
|
|
return this.missCount.get(); |
|
|
|
return this.missCount.get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void reset() { |
|
|
|
public void reset() { |
|
|
|
synchronized (this.contextMap) { |
|
|
|
synchronized (this.contextMap) { |
|
|
|
@ -287,9 +254,6 @@ public class DefaultContextCache implements ContextCache { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void clear() { |
|
|
|
public void clear() { |
|
|
|
synchronized (this.contextMap) { |
|
|
|
synchronized (this.contextMap) { |
|
|
|
@ -298,9 +262,6 @@ public class DefaultContextCache implements ContextCache { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void clearStatistics() { |
|
|
|
public void clearStatistics() { |
|
|
|
synchronized (this.contextMap) { |
|
|
|
synchronized (this.contextMap) { |
|
|
|
@ -309,9 +270,6 @@ public class DefaultContextCache implements ContextCache { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritDoc} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void logStatistics() { |
|
|
|
public void logStatistics() { |
|
|
|
if (statsLogger.isDebugEnabled()) { |
|
|
|
if (statsLogger.isDebugEnabled()) { |
|
|
|
|