|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2018 the original author or authors. |
|
|
|
* Copyright 2002-2020 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -160,23 +160,12 @@ public class AspectJProxyFactory extends ProxyCreatorSupport { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Get the singleton aspect instance for the supplied aspect type. An instance |
|
|
|
* Get the singleton aspect instance for the supplied aspect type. |
|
|
|
* is created if one cannot be found in the instance cache. |
|
|
|
* An instance is created if one cannot be found in the instance cache. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Object getSingletonAspectInstance(Class<?> aspectClass) { |
|
|
|
private Object getSingletonAspectInstance(Class<?> aspectClass) { |
|
|
|
// Quick check without a lock...
|
|
|
|
return aspectCache.computeIfAbsent(aspectClass, |
|
|
|
Object instance = aspectCache.get(aspectClass); |
|
|
|
clazz -> new SimpleAspectInstanceFactory(clazz).getAspectInstance()); |
|
|
|
if (instance == null) { |
|
|
|
|
|
|
|
synchronized (aspectCache) { |
|
|
|
|
|
|
|
// To be safe, check within full lock now...
|
|
|
|
|
|
|
|
instance = aspectCache.get(aspectClass); |
|
|
|
|
|
|
|
if (instance == null) { |
|
|
|
|
|
|
|
instance = new SimpleAspectInstanceFactory(aspectClass).getAspectInstance(); |
|
|
|
|
|
|
|
aspectCache.put(aspectClass, instance); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return instance; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|