List of usage examples for org.springframework.batch.core.scope.context JobContext getAttribute
@Override
public Object getAttribute(String name)
From source file:org.springframework.batch.core.scope.JobScope.java
/** * @see Scope#get(String, ObjectFactory) *//* w ww .j a v a2 s . c om*/ @Override public Object get(String name, ObjectFactory<?> objectFactory) { JobContext context = getContext(); Object scopedObject = context.getAttribute(name); if (scopedObject == null) { synchronized (mutex) { scopedObject = context.getAttribute(name); if (scopedObject == null) { if (logger.isDebugEnabled()) { logger.debug(String.format("Creating object in scope=%s, name=%s", this.getName(), name)); } scopedObject = objectFactory.getObject(); context.setAttribute(name, scopedObject); } } } return scopedObject; }