org.springframework.aop.aspectj.SimpleAspectInstanceFactory Java Examples

The following examples show how to use org.springframework.aop.aspectj.SimpleAspectInstanceFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AspectJProxyFactory.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Get the singleton aspect instance for the supplied aspect type. An instance
 * is created if one cannot be found in the instance cache.
 */
private Object getSingletonAspectInstance(Class<?> aspectClass) {
	// Quick check without a lock...
	Object instance = aspectCache.get(aspectClass);
	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;
}
 
Example #2
Source File: AspectJProxyFactory.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Get the singleton aspect instance for the supplied aspect type. An instance
 * is created if one cannot be found in the instance cache.
 */
private Object getSingletonAspectInstance(Class<?> aspectClass) {
	// Quick check without a lock...
	Object instance = aspectCache.get(aspectClass);
	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;
}