diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/build/ApolloInjector.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/build/ApolloInjector.java index 4c01e396d76..62177eebb8b 100644 --- a/apollo-client/src/main/java/com/ctrip/framework/apollo/build/ApolloInjector.java +++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/build/ApolloInjector.java @@ -9,7 +9,7 @@ * @author Jason Song(song_s@ctrip.com) */ public class ApolloInjector { - private static Injector s_injector; + private static volatile Injector s_injector; private static Object lock = new Object(); private static Injector getInjector() { diff --git a/apollo-core/src/main/java/com/ctrip/framework/foundation/Foundation.java b/apollo-core/src/main/java/com/ctrip/framework/foundation/Foundation.java index 31b40021b72..0c13b9fce95 100644 --- a/apollo-core/src/main/java/com/ctrip/framework/foundation/Foundation.java +++ b/apollo-core/src/main/java/com/ctrip/framework/foundation/Foundation.java @@ -13,7 +13,7 @@ public abstract class Foundation { private static final Logger logger = LoggerFactory.getLogger(Foundation.class); private static Object lock = new Object(); - private static ProviderManager s_manager; + private static volatile ProviderManager s_manager; // Encourage early initialization and fail early if it happens. static {