diff --git a/core/src/main/java/com/opensymphony/xwork2/inject/Scope.java b/core/src/main/java/com/opensymphony/xwork2/inject/Scope.java index 86592bbe1..3974d6c8b 100644 --- a/core/src/main/java/com/opensymphony/xwork2/inject/Scope.java +++ b/core/src/main/java/com/opensymphony/xwork2/inject/Scope.java @@ -44,15 +44,17 @@ public enum Scope { @Override InternalFactory scopeFactory(Class type, String name, final InternalFactory factory) { return new InternalFactory() { - T instance; + volatile T instance; public T create(InternalContext context) { - synchronized (context.getContainer()) { - if (instance == null) { - instance = InitializableFactory.wrapIfNeeded(factory).create(context); + if (instance == null) { + synchronized (context.getContainer()) { + if (instance == null) { + instance = InitializableFactory.wrapIfNeeded(factory).create(context); + } } - return instance; } + return instance; } @Override