Protect against non-deterministic method order in JDK7
- Allow reset of GlobalAdvisorAdapterRegistry Provide a reset() method allowing the GlobalAdvisorAdapterRegistry instance to be replaced with a fresh instance. This method has primarily been added to allow unit tests to leave the registry in a known state. - Protect against the fact that calls to configuration class methods my occur in a random order. Issue: SPR-9779
This commit is contained in:
committed by
Chris Beams
parent
8e7622bb8a
commit
a9a90cabad
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -21,6 +21,7 @@ package org.springframework.aop.framework.adapter;
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @author Phillip Webb
|
||||
* @see DefaultAdvisorAdapterRegistry
|
||||
*/
|
||||
public abstract class GlobalAdvisorAdapterRegistry {
|
||||
@@ -28,13 +29,22 @@ public abstract class GlobalAdvisorAdapterRegistry {
|
||||
/**
|
||||
* Keep track of a single instance so we can return it to classes that request it.
|
||||
*/
|
||||
private static final AdvisorAdapterRegistry instance = new DefaultAdvisorAdapterRegistry();
|
||||
|
||||
private static AdvisorAdapterRegistry instance = new DefaultAdvisorAdapterRegistry();
|
||||
|
||||
/**
|
||||
* Return the singleton DefaultAdvisorAdapterRegistry instance.
|
||||
* Return the singleton {@link DefaultAdvisorAdapterRegistry} instance.
|
||||
*/
|
||||
public static AdvisorAdapterRegistry getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the singleton {@link DefaultAdvisorAdapterRegistry}, removing any
|
||||
* {@link AdvisorAdapterRegistry#registerAdvisorAdapter(AdvisorAdapter) registered}
|
||||
* adapters.
|
||||
*/
|
||||
static void reset() {
|
||||
instance = new DefaultAdvisorAdapterRegistry();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user