proj_name
stringclasses
131 values
relative_path
stringlengths
30
228
class_name
stringlengths
1
68
func_name
stringlengths
1
48
masked_class
stringlengths
78
9.82k
func_body
stringlengths
46
9.61k
len_input
int64
29
2.01k
len_output
int64
14
1.94k
total
int64
55
2.05k
relevant_context
stringlengths
0
38.4k
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/Entity.java
Entity
equals
class Entity implements Serializable { private Long id; private volatile Integer version; /** * Default constructor for {@link Entity}. * <p> * The ID defaults to zero. */ public Entity() { super(); } /** * The constructor for the {@link Entity} where the ID is established. * @param id The ID fo...
if (other == this) { return true; } if (other == null) { return false; } if (!(other instanceof Entity entity)) { return false; } if (id == null || entity.getId() == null) { return false; } return id.equals(entity.getId());
814
92
906
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/JobInstance.java
JobInstance
toString
class JobInstance extends Entity { private final String jobName; /** * Constructor for {@link JobInstance}. * @param id The instance ID. * @param jobName The name associated with the {@link JobInstance}. */ public JobInstance(Long id, String jobName) { super(id); Assert.hasLength(jobName, "A jobName is...
return super.toString() + ", Job=[" + jobName + "]";
240
22
262
<methods>public void <init>() ,public void <init>(java.lang.Long) ,public boolean equals(java.lang.Object) ,public java.lang.Long getId() ,public java.lang.Integer getVersion() ,public int hashCode() ,public void incrementVersion() ,public void setId(java.lang.Long) ,public void setVersion(java.lang.Integer) ,public ja...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/JobParameter.java
JobParameter
equals
class JobParameter<T> implements Serializable { private final T value; private final Class<T> type; private final boolean identifying; /** * Create a new {@link JobParameter}. * @param value the value of the parameter. Must not be {@code null}. * @param type the type of the parameter. Must not be {@code n...
if (!(obj instanceof JobParameter rhs)) { return false; } if (this == obj) { return true; } return type == rhs.type && value.equals(rhs.value);
502
62
564
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/SpringBatchVersion.java
SpringBatchVersion
getVersion
class SpringBatchVersion { /** * The key to use in the execution context for batch version. */ public static final String BATCH_VERSION_KEY = "batch.version"; private SpringBatchVersion() { } /** * Return the full version string of the present Spring Batch codebase, or * {@code "N/A"} if it cannot be de...
Package pkg = SpringBatchVersion.class.getPackage(); if (pkg != null && pkg.getImplementationVersion() != null) { return pkg.getImplementationVersion(); } return "N/A";
132
63
195
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/StepContribution.java
StepContribution
toString
class StepContribution implements Serializable { private volatile long readCount = 0; private volatile long writeCount = 0; private volatile long filterCount = 0; private final long parentSkipCount; private volatile long readSkipCount; private volatile long writeSkipCount; private volatile long processSki...
return "[StepContribution: read=" + readCount + ", written=" + writeCount + ", filtered=" + filterCount + ", readSkips=" + readSkipCount + ", writeSkips=" + writeSkipCount + ", processSkips=" + processSkipCount + ", exitStatus=" + exitStatus.getExitCode() + "]";
1,206
88
1,294
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/aot/CoreRuntimeHints.java
CoreRuntimeHints
registerHints
class CoreRuntimeHints implements RuntimeHintsRegistrar { @Override public void registerHints(RuntimeHints hints, ClassLoader classLoader) {<FILL_FUNCTION_BODY>} }
Set<String> jdkTypes = Set.of("java.time.Ser", "java.util.Collections$SynchronizedSet", "java.util.Collections$SynchronizedCollection", "java.util.concurrent.locks.ReentrantLock$Sync", "java.util.concurrent.locks.ReentrantLock$FairSync", "java.util.concurrent.locks.ReentrantLock$NonfairSync", "java....
51
1,330
1,381
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/AutomaticJobRegistrarBeanPostProcessor.java
AutomaticJobRegistrarBeanPostProcessor
postProcessAfterInitialization
class AutomaticJobRegistrarBeanPostProcessor implements BeanFactoryPostProcessor, BeanPostProcessor { private ConfigurableListableBeanFactory beanFactory; @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { this.beanFactory = beanFactory; } @Overri...
if (bean instanceof AutomaticJobRegistrar automaticJobRegistrar) { automaticJobRegistrar.setJobLoader(new DefaultJobLoader(this.beanFactory.getBean(JobRegistry.class))); for (ApplicationContextFactory factory : this.beanFactory.getBeansOfType(ApplicationContextFactory.class) .values()) { automaticJobRe...
113
123
236
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/BatchObservabilityBeanPostProcessor.java
BatchObservabilityBeanPostProcessor
postProcessAfterInitialization
class BatchObservabilityBeanPostProcessor implements BeanFactoryPostProcessor, BeanPostProcessor { private static final Log LOGGER = LogFactory.getLog(BatchObservabilityBeanPostProcessor.class); private ConfigurableListableBeanFactory beanFactory; @Override public void postProcessBeanFactory(ConfigurableListable...
try { if (bean instanceof AbstractJob || bean instanceof AbstractStep) { ObservationRegistry observationRegistry = this.beanFactory.getBean(ObservationRegistry.class); if (bean instanceof AbstractJob) { ((AbstractJob) bean).setObservationRegistry(observationRegistry); } if (bean instanceof Ab...
135
162
297
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrar.java
AutomaticJobRegistrar
start
class AutomaticJobRegistrar implements Ordered, SmartLifecycle, ApplicationContextAware, InitializingBean { private final Collection<ApplicationContextFactory> applicationContextFactories = new ArrayList<>(); private JobLoader jobLoader; private ApplicationContext applicationContext; private volatile boolean ru...
synchronized (this.lifecycleMonitor) { if (running) { return; } for (ApplicationContextFactory factory : applicationContextFactories) { try { jobLoader.load(factory); } catch (DuplicateJobException e) { throw new IllegalStateException(e); } } running = true; }
1,055
104
1,159
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ClasspathXmlApplicationContextsFactoryBean.java
ClasspathXmlApplicationContextsFactoryBean
getObject
class ClasspathXmlApplicationContextsFactoryBean implements FactoryBean<ApplicationContextFactory[]>, ApplicationContextAware { private List<Resource> resources = new ArrayList<>(); private boolean copyConfiguration = true; private Class<? extends BeanFactoryPostProcessor>[] beanFactoryPostProcessorClasses; p...
if (resources == null) { return new ApplicationContextFactory[0]; } List<ApplicationContextFactory> applicationContextFactories = new ArrayList<>(); for (Resource resource : resources) { GenericApplicationContextFactory factory = new GenericApplicationContextFactory(resource); factory.setCopyConfigu...
917
209
1,126
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/GenericApplicationContextFactory.java
GenericApplicationContextFactory
createApplicationContext
class GenericApplicationContextFactory extends AbstractApplicationContextFactory { /** * Create an application context factory for the specified resource. The resource can * be an actual {@link Resource} (in which case, it is interpreted as an XML file), or * it can be a &#64;Configuration class or a package na...
ConfigurableApplicationContext context; if (allObjectsOfType(resources, Resource.class)) { context = new ResourceXmlApplicationContext(parent, resources); } else if (allObjectsOfType(resources, Class.class)) { context = new ResourceAnnotationApplicationContext(parent, resources); } else if (allObjec...
1,585
203
1,788
<methods>public transient void <init>(java.lang.Object[]) ,public org.springframework.context.ConfigurableApplicationContext createApplicationContext() ,public boolean equals(java.lang.Object) ,public int hashCode() ,public void setApplicationContext(org.springframework.context.ApplicationContext) throws org.springfram...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/GroupAwareJob.java
GroupAwareJob
equals
class GroupAwareJob implements Job { /** * The separator between group and delegate job names in the final name given to this * job. */ private static final String SEPARATOR = "."; private final Job delegate; private final String groupName; /** * Create a new {@link Job} with the delegate and no group ...
if (obj instanceof GroupAwareJob) { return ((GroupAwareJob) obj).delegate.equals(delegate); } return false;
525
44
569
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobFactoryRegistrationListener.java
JobFactoryRegistrationListener
unbind
class JobFactoryRegistrationListener { private final Log logger = LogFactory.getLog(getClass()); private JobRegistry jobRegistry; /** * Public setter for a {@link JobRegistry} to use for all the bind and unbind events. * @param jobRegistry {@link JobRegistry} */ public void setJobRegistry(JobRegistry jobRe...
if (logger.isInfoEnabled()) { logger.info("Unbinding JobFactory: " + jobFactory.getJobName()); } jobRegistry.unregister(jobFactory.getJobName());
334
54
388
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessor.java
JobRegistryBeanPostProcessor
destroy
class JobRegistryBeanPostProcessor implements BeanPostProcessor, BeanFactoryAware, InitializingBean, DisposableBean { private static final Log logger = LogFactory.getLog(JobRegistryBeanPostProcessor.class); // It doesn't make sense for this to have a default value... private JobRegistry jobRegistry = null; pri...
for (String name : jobNames) { if (logger.isDebugEnabled()) { logger.debug("Unregistering job: " + name); } jobRegistry.unregister(name); } jobNames.clear();
1,043
66
1,109
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobRegistrySmartInitializingSingleton.java
JobRegistrySmartInitializingSingleton
destroy
class JobRegistrySmartInitializingSingleton implements SmartInitializingSingleton, BeanFactoryAware, InitializingBean, DisposableBean { private static final Log logger = LogFactory.getLog(JobRegistrySmartInitializingSingleton.class); // It doesn't make sense for this to have a default value... private JobRegistr...
for (String name : jobNames) { if (logger.isDebugEnabled()) { logger.debug("Unregistering job: " + name); } jobRegistry.unregister(name); } jobNames.clear();
1,021
66
1,087
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/MapJobRegistry.java
MapJobRegistry
register
class MapJobRegistry implements JobRegistry { /** * The map holding the registered job factories. */ // The "final" ensures that it is visible and initialized when the constructor // resolves. private final ConcurrentMap<String, JobFactory> map = new ConcurrentHashMap<>(); @Override public void register(Job...
Assert.notNull(jobFactory, "jobFactory is null"); String name = jobFactory.getJobName(); Assert.notNull(name, "Job configuration must have a name."); JobFactory previousValue = map.putIfAbsent(name, jobFactory); if (previousValue != null) { throw new DuplicateJobException("A job configuration with this na...
287
110
397
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/MapStepRegistry.java
MapStepRegistry
getStep
class MapStepRegistry implements StepRegistry { private final ConcurrentMap<String, Map<String, Step>> map = new ConcurrentHashMap<>(); @Override public void register(String jobName, Collection<Step> steps) throws DuplicateJobException { Assert.notNull(jobName, "The job name cannot be null."); Assert.notNull(s...
Assert.notNull(jobName, "The job name cannot be null."); Assert.notNull(stepName, "The step name cannot be null."); if (!map.containsKey(jobName)) { throw new NoSuchJobException("No job configuration with the name [" + jobName + "] was registered"); } else { final Map<String, Step> jobSteps = map.get(j...
301
185
486
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractListenerParser.java
AbstractListenerParser
parseListenerElement
class AbstractListenerParser { private static final String ID_ATTR = "id"; private static final String REF_ATTR = "ref"; private static final String BEAN_ELE = "bean"; private static final String REF_ELE = "ref"; public AbstractBeanDefinition parse(Element element, ParserContext parserContext) { BeanDefinit...
String listenerRef = element.getAttribute(REF_ATTR); List<Element> beanElements = DomUtils.getChildElementsByTagName(element, BEAN_ELE); List<Element> refElements = DomUtils.getChildElementsByTagName(element, REF_ELE); verifyListenerAttributesAndSubelements(listenerRef, beanElements, refElements, element, par...
989
259
1,248
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/CoreNamespaceHandler.java
CoreNamespaceHandler
init
class CoreNamespaceHandler extends NamespaceHandlerSupport { /** * @see NamespaceHandler#init() */ @Override public void init() {<FILL_FUNCTION_BODY>} }
this.registerBeanDefinitionParser("job", new JobParser()); this.registerBeanDefinitionParser("flow", new TopLevelFlowParser()); this.registerBeanDefinitionParser("step", new TopLevelStepParser()); this.registerBeanDefinitionParser("job-repository", new JobRepositoryParser()); this.registerBeanDefinitionParse...
52
112
164
<methods>public void <init>() ,public org.springframework.beans.factory.config.BeanDefinitionHolder decorate(org.w3c.dom.Node, org.springframework.beans.factory.config.BeanDefinitionHolder, org.springframework.beans.factory.xml.ParserContext) ,public org.springframework.beans.factory.config.BeanDefinition parse(org.w3c...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/CoreNamespacePostProcessor.java
CoreNamespacePostProcessor
overrideStepClass
class CoreNamespacePostProcessor implements BeanPostProcessor, BeanFactoryPostProcessor, ApplicationContextAware { private static final String DEFAULT_JOB_REPOSITORY_NAME = "jobRepository"; private static final String DEFAULT_TRANSACTION_MANAGER_NAME = "transactionManager"; private static final String JOB_FACTO...
BeanDefinition bd = beanFactory.getBeanDefinition(beanName); Object isNamespaceStep = BeanDefinitionUtils.getAttribute(beanName, "isNamespaceStep", beanFactory); if (isNamespaceStep != null && (Boolean) isNamespaceStep) { ((AbstractBeanDefinition) bd).setBeanClass(StepParserStepFactoryBean.class); }
1,175
93
1,268
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/DecisionParser.java
DecisionParser
parse
class DecisionParser { /** * Parse the decision and turn it into a list of transitions. * @param element the &lt;decision/gt; element to parse * @param parserContext the parser context for the bean factory * @return a collection of bean definitions for * {@link org.springframework.batch.core.job.flow.suppor...
String refAttribute = element.getAttribute("decider"); String idAttribute = element.getAttribute("id"); BeanDefinitionBuilder stateBuilder = BeanDefinitionBuilder .genericBeanDefinition("org.springframework.batch.core.job.flow.support.state.DecisionState"); stateBuilder.addConstructorArgValue(new RuntimeB...
133
130
263
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/ExceptionElementParser.java
ExceptionElementParser
parse
class ExceptionElementParser { public ManagedMap<TypedStringValue, Boolean> parse(Element element, ParserContext parserContext, String exceptionListName) {<FILL_FUNCTION_BODY>} private void addExceptionClasses(String elementName, boolean include, Element exceptionClassesElement, ManagedMap<TypedStringValue, B...
List<Element> children = DomUtils.getChildElementsByTagName(element, exceptionListName); if (children.size() == 1) { ManagedMap<TypedStringValue, Boolean> map = new ManagedMap<>(); Element exceptionClassesElement = children.get(0); addExceptionClasses("include", true, exceptionClassesElement, map, parserC...
160
230
390
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/FlowElementParser.java
FlowElementParser
parse
class FlowElementParser { private static final String ID_ATTR = "id"; private static final String REF_ATTR = "parent"; /** * Parse the flow and turn it into a list of transitions. * @param element The &lt;flow/gt; element to parse. * @param parserContext The parser context for the bean factory. * @return ...
String refAttribute = element.getAttribute(REF_ATTR); String idAttribute = element.getAttribute(ID_ATTR); BeanDefinitionBuilder stateBuilder = BeanDefinitionBuilder .genericBeanDefinition("org.springframework.batch.core.job.flow.support.state.FlowState"); AbstractBeanDefinition flowDefinition = new Gener...
162
188
350
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/InlineFlowParser.java
InlineFlowParser
doParse
class InlineFlowParser extends AbstractFlowParser { private final String flowName; /** * Construct a {@link InlineFlowParser} with the specified name and using the provided * job repository reference. * @param flowName The name of the flow. * @param jobFactoryRef The reference to the {@link JobParserJobFact...
builder.getRawBeanDefinition().setAttribute("flowName", flowName); builder.addPropertyValue("name", flowName); builder.addPropertyValue("stateTransitionComparator", new RuntimeBeanReference(DefaultStateTransitionComparator.STATE_TRANSITION_COMPARATOR)); super.doParse(element, parserContext, builder); bui...
242
129
371
<methods>public non-sealed void <init>() ,public static Collection<org.springframework.beans.factory.config.BeanDefinition> getNextElements(org.springframework.beans.factory.xml.ParserContext, org.springframework.beans.factory.config.BeanDefinition, org.w3c.dom.Element) ,public static Collection<org.springframework.bea...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/InlineStepParser.java
InlineStepParser
parse
class InlineStepParser extends AbstractStepParser { /** * Parse the step and turn it into a list of transitions. * @param element The &lt;step/gt; element to parse. * @param parserContext The parser context for the bean factory. * @param jobFactoryRef The reference to the {@link JobParserJobFactoryBean} from ...
BeanDefinitionBuilder stateBuilder = BeanDefinitionBuilder.genericBeanDefinition(StepState.class); String stepId = element.getAttribute(ID_ATTR); AbstractBeanDefinition bd = parseStep(element, parserContext, jobFactoryRef); parserContext.registerBeanComponent(new BeanComponentDefinition(bd, stepId)); state...
175
128
303
<methods>public non-sealed void <init>() <variables>private static final java.lang.String AGGREGATOR_ATTR,private static final java.lang.String ALLOW_START_ATTR,private static final java.lang.String FLOW_ELE,private static final java.lang.String GRID_SIZE_ATTR,private static final java.lang.String HANDLER_ATTR,private ...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParser.java
JobParser
doParse
class JobParser extends AbstractSingleBeanDefinitionParser { private static final String MERGE_ATTR = "merge"; private static final String REF_ATTR = "ref"; private static final String BEAN_ELE = "bean"; private static final String REF_ELE = "ref"; private static final JobExecutionListenerParser jobListenerPa...
if (!CoreNamespaceUtils.namespaceMatchesVersion(element)) { parserContext.getReaderContext() .error("You are using a version of the spring-batch XSD that is not compatible with Spring Batch 3.0." + " Please upgrade your schema declarations (or use the spring-batch.xsd alias if you are " + "feeli...
587
999
1,586
<methods>public void <init>() <variables>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParserJobFactoryBean.java
JobParserJobFactoryBean
getObject
class JobParserJobFactoryBean implements SmartFactoryBean<FlowJob> { private final String name; private Boolean restartable; private JobRepository jobRepository; private JobParametersValidator jobParametersValidator; private JobExecutionListener[] jobExecutionListeners; private JobParametersIncrementer jobP...
Assert.isTrue(StringUtils.hasText(name), "The job must have an id."); FlowJob flowJob = new FlowJob(name); if (restartable != null) { flowJob.setRestartable(restartable); } if (jobRepository != null) { flowJob.setJobRepository(jobRepository); } if (jobParametersValidator != null) { flowJob.se...
700
247
947
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobRepositoryParser.java
JobRepositoryParser
doParse
class JobRepositoryParser extends AbstractSingleBeanDefinitionParser { @Override protected String getBeanClassName(Element element) { return "org.springframework.batch.core.repository.support.JobRepositoryFactoryBean"; } @Override protected String resolveId(Element element, AbstractBeanDefinition definition, P...
CoreNamespaceUtils.autoregisterBeansForNamespace(parserContext, element); String dataSource = element.getAttribute("data-source"); String jdbcOperations = element.getAttribute("jdbc-operations"); String transactionManager = element.getAttribute("transaction-manager"); String isolationLevelForCreate = el...
223
528
751
<methods>public void <init>() <variables>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SimpleFlowFactoryBean.java
SimpleFlowFactoryBean
getObject
class SimpleFlowFactoryBean implements FactoryBean<SimpleFlow>, InitializingBean { private String name; private List<StateTransition> stateTransitions; private String prefix; private Comparator<StateTransition> stateTransitionComparator; private Class<SimpleFlow> flowType; /** * @param stateTransitionComp...
SimpleFlow flow = flowType.getConstructor(String.class).newInstance(name); flow.setStateTransitionComparator(stateTransitionComparator); List<StateTransition> updatedTransitions = new ArrayList<>(); for (StateTransition stateTransition : stateTransitions) { State state = getProxyState(stateTransition.getS...
1,156
169
1,325
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SplitParser.java
SplitParser
parse
class SplitParser { private static final String PARENT_ATTR = "parent"; private final String jobFactoryRef; /** * Construct a {@link InlineFlowParser} by using the provided job repository * reference. * @param jobFactoryRef The reference to the {@link JobParserJobFactoryBean} from the * enclosing tag. *...
String idAttribute = element.getAttribute("id"); BeanDefinitionBuilder stateBuilder = BeanDefinitionBuilder .genericBeanDefinition("org.springframework.batch.core.job.flow.support.state.SplitState"); String taskExecutorBeanId = element.getAttribute("task-executor"); if (StringUtils.hasText(taskExecutorBe...
240
539
779
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepListenerParser.java
StepListenerParser
handleListenersElement
class StepListenerParser extends AbstractListenerParser { private static final String LISTENERS_ELE = "listeners"; private static final String MERGE_ATTR = "merge"; private final ListenerMetaData[] listenerMetaData; public StepListenerParser() { this(StepListenerMetaData.values()); } public StepListenerPar...
MutablePropertyValues propertyValues = beanDefinition.getPropertyValues(); List<Element> listenersElements = DomUtils.getChildElementsByTagName(stepElement, LISTENERS_ELE); if (listenersElements.size() == 1) { Element listenersElement = listenersElements.get(0); CompositeComponentDefinition compositeDef = ...
224
353
577
<methods>public non-sealed void <init>() ,public void doParse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder) ,public org.springframework.beans.factory.support.AbstractBeanDefinition parse(org.w3c.dom.Element, org.springframework...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/TopLevelFlowParser.java
TopLevelFlowParser
doParse
class TopLevelFlowParser extends AbstractFlowParser { private static final String ABSTRACT_ATTR = "abstract"; /** * Parse the flow. * @param element the top level element containing a flow definition * @param parserContext the {@link ParserContext} */ @Override protected void doParse(Element element, Pars...
CoreNamespaceUtils.autoregisterBeansForNamespace(parserContext, element); String flowName = element.getAttribute(ID_ATTR); builder.getRawBeanDefinition().setAttribute("flowName", flowName); builder.addPropertyValue("name", flowName); builder.addPropertyValue("stateTransitionComparator", new RuntimeBeanRe...
110
179
289
<methods>public non-sealed void <init>() ,public static Collection<org.springframework.beans.factory.config.BeanDefinition> getNextElements(org.springframework.beans.factory.xml.ParserContext, org.springframework.beans.factory.config.BeanDefinition, org.w3c.dom.Element) ,public static Collection<org.springframework.bea...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/converter/DefaultJobParametersConverter.java
DefaultJobParametersConverter
parseType
class DefaultJobParametersConverter implements JobParametersConverter { protected ConfigurableConversionService conversionService; public DefaultJobParametersConverter() { DefaultConversionService conversionService = new DefaultConversionService(); conversionService.addConverter(new DateToStringConverter()); ...
String[] tokens = StringUtils.commaDelimitedListToStringArray(encodedJobParameter); if (tokens.length <= 1) { return String.class; } try { Class<?> type = Class.forName(tokens[1]); return type; } catch (ClassNotFoundException e) { throw new JobParametersConversionException("Unable to parse job ...
1,200
119
1,319
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/converter/JsonJobParametersConverter.java
JsonJobParametersConverter
decode
class JsonJobParametersConverter extends DefaultJobParametersConverter { private final ObjectMapper objectMapper; /** * Create a new {@link JsonJobParametersConverter} with a default * {@link ObjectMapper}. */ public JsonJobParametersConverter() { this(new ObjectMapper()); } /** * Create a new {@link ...
try { JobParameterDefinition jobParameterDefinition = this.objectMapper.readValue(encodedJobParameter, JobParameterDefinition.class); Class<?> parameterType = String.class; if (jobParameterDefinition.type() != null) { parameterType = Class.forName(jobParameterDefinition.type()); } boolean par...
382
240
622
<methods>public void <init>() ,public org.springframework.batch.core.JobParameters getJobParameters(java.util.Properties) ,public java.util.Properties getProperties(org.springframework.batch.core.JobParameters) ,public void setConversionService(org.springframework.core.convert.support.ConfigurableConversionService) <va...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/AbstractJobExplorerFactoryBean.java
AbstractJobExplorerFactoryBean
afterPropertiesSet
class AbstractJobExplorerFactoryBean implements FactoryBean<JobExplorer>, InitializingBean { private static final String TRANSACTION_ISOLATION_LEVEL_PREFIX = "ISOLATION_"; private static final String TRANSACTION_PROPAGATION_PREFIX = "PROPAGATION_"; private PlatformTransactionManager transactionManager; private ...
Assert.notNull(this.transactionManager, "TransactionManager must not be null."); if (this.transactionAttributeSource == null) { Properties transactionAttributes = new Properties(); String transactionProperties = String.join(",", TRANSACTION_PROPAGATION_PREFIX + Propagation.SUPPORTS, TRANSACTION_ISOLATIO...
950
177
1,127
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/JobExplorerFactoryBean.java
JobExplorerFactoryBean
afterPropertiesSet
class JobExplorerFactoryBean extends AbstractJobExplorerFactoryBean implements InitializingBean { private DataSource dataSource; private JdbcOperations jdbcOperations; private String tablePrefix = AbstractJdbcBatchMetadataDao.DEFAULT_TABLE_PREFIX; private final DataFieldMaxValueIncrementer incrementer = new Abs...
Assert.state(dataSource != null, "DataSource must not be null."); if (jdbcOperations == null) { jdbcOperations = new JdbcTemplate(dataSource); } if (jobKeyGenerator == null) { jobKeyGenerator = new DefaultJobKeyGenerator(); } if (serializer == null) { serializer = new DefaultExecutionContextSe...
1,464
295
1,759
<methods>public non-sealed void <init>() ,public void afterPropertiesSet() throws java.lang.Exception,public org.springframework.batch.core.explore.JobExplorer getObject() throws java.lang.Exception,public Class<org.springframework.batch.core.explore.JobExplorer> getObjectType() ,public org.springframework.transaction....
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/SimpleJobExplorer.java
SimpleJobExplorer
getStepExecution
class SimpleJobExplorer implements JobExplorer { private JobInstanceDao jobInstanceDao; private JobExecutionDao jobExecutionDao; private StepExecutionDao stepExecutionDao; private ExecutionContextDao ecDao; /** * Provides a default constructor with low visibility in case you want to use * aop:proxy-target...
JobExecution jobExecution = jobExecutionDao.getJobExecution(jobExecutionId); if (jobExecution == null) { return null; } getJobExecutionDependencies(jobExecution); StepExecution stepExecution = stepExecutionDao.getStepExecution(jobExecution, executionId); getStepExecutionDependencies(stepExecution); re...
1,543
95
1,638
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/CompositeJobParametersValidator.java
CompositeJobParametersValidator
afterPropertiesSet
class CompositeJobParametersValidator implements JobParametersValidator, InitializingBean { private List<JobParametersValidator> validators; /** * Validates the JobParameters according to the injected JobParameterValidators * Validation stops and exception is thrown on first validation error * @param paramete...
Assert.state(validators != null, "The 'validators' may not be null"); Assert.state(!validators.isEmpty(), "The 'validators' may not be empty");
238
50
288
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/DefaultJobParametersValidator.java
DefaultJobParametersValidator
validate
class DefaultJobParametersValidator implements JobParametersValidator, InitializingBean { private static final Log logger = LogFactory.getLog(DefaultJobParametersValidator.class); private Collection<String> requiredKeys; private Collection<String> optionalKeys; /** * Convenient default constructor for unconst...
if (parameters == null) { throw new JobParametersInvalidException("The JobParameters can not be null"); } Set<String> keys = parameters.getParameters().keySet(); // If there are explicit optional keys then all keys must be in that // group, or in the required group. if (!optionalKeys.isEmpty()) { ...
666
294
960
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/SimpleJob.java
SimpleJob
doExecute
class SimpleJob extends AbstractJob { private final List<Step> steps = new ArrayList<>(); /** * Default constructor for job with null name */ public SimpleJob() { this(null); } /** * @param name the job name. */ public SimpleJob(String name) { super(name); } /** * Public setter for the steps i...
StepExecution stepExecution = null; for (Step step : steps) { stepExecution = handleStep(step, execution); if (stepExecution.getStatus() != BatchStatus.COMPLETED) { // // Terminate the job if a step fails // break; } } // // Update the job status to be the same as the last step /...
599
184
783
<methods>public void <init>() ,public void <init>(java.lang.String) ,public void afterPropertiesSet() throws java.lang.Exception,public final void execute(org.springframework.batch.core.JobExecution) ,public org.springframework.batch.core.JobParametersIncrementer getJobParametersIncrementer() ,public org.springframewor...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/SimpleStepHandler.java
SimpleStepHandler
shouldStart
class SimpleStepHandler implements StepHandler, InitializingBean { private static final Log logger = LogFactory.getLog(SimpleStepHandler.class); private JobRepository jobRepository; private ExecutionContext executionContext; /** * Convenient default constructor for configuration usage. */ public SimpleStep...
BatchStatus stepStatus; if (lastStepExecution == null) { stepStatus = BatchStatus.STARTING; } else { stepStatus = lastStepExecution.getStatus(); } if (stepStatus == BatchStatus.UNKNOWN) { throw new JobRestartException("Cannot restart step from UNKNOWN status. " + "The last execution ended w...
1,517
369
1,886
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowJobBuilder.java
FlowJobBuilder
build
class FlowJobBuilder extends JobBuilderHelper<FlowJobBuilder> { private Flow flow; /** * Create a new builder initialized with any properties in the parent. The parent is * copied, so it can be re-used. * @param parent a parent helper containing common job properties */ public FlowJobBuilder(JobBuilderHelp...
FlowJob job = new FlowJob(); job.setName(getName()); job.setFlow(flow); super.enhance(job); try { job.afterPropertiesSet(); } catch (Exception e) { throw new StepBuilderException(e); } return job;
474
90
564
<methods>public void <init>(java.lang.String) ,public void <init>(java.lang.String, org.springframework.batch.core.repository.JobRepository) ,public org.springframework.batch.core.job.builder.FlowJobBuilder incrementer(org.springframework.batch.core.JobParametersIncrementer) ,public org.springframework.batch.core.job.b...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/JobFlowBuilder.java
JobFlowBuilder
build
class JobFlowBuilder extends FlowBuilder<FlowJobBuilder> { private final FlowJobBuilder parent; public JobFlowBuilder(FlowJobBuilder parent) { super(parent.getName()); this.parent = parent; } public JobFlowBuilder(FlowJobBuilder parent, Step step) { super(parent.getName()); this.parent = parent; start(...
Flow flow = flow(); if (flow instanceof InitializingBean) { try { ((InitializingBean) flow).afterPropertiesSet(); } catch (Exception e) { throw new FlowBuilderException(e); } } parent.flow(flow); return parent;
291
86
377
<methods>public void <init>(java.lang.String) ,public org.springframework.batch.core.job.builder.FlowJobBuilder build() ,public final org.springframework.batch.core.job.builder.FlowJobBuilder end() ,public FlowBuilder<org.springframework.batch.core.job.builder.FlowJobBuilder> from(org.springframework.batch.core.Step) ,...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/SimpleJobBuilder.java
SimpleJobBuilder
on
class SimpleJobBuilder extends JobBuilderHelper<SimpleJobBuilder> { private final List<Step> steps = new ArrayList<>(); private JobFlowBuilder builder; /** * Create a new builder initialized with any properties in the parent. The parent is * copied, so it can be re-used. * @param parent the parent to use ...
Assert.state(steps.size() > 0, "You have to start a job with a step"); for (Step step : steps) { if (builder == null) { builder = new JobFlowBuilder(new FlowJobBuilder(this), step); } else { builder.next(step); } } return builder.on(pattern);
1,017
97
1,114
<methods>public void <init>(java.lang.String) ,public void <init>(java.lang.String, org.springframework.batch.core.repository.JobRepository) ,public org.springframework.batch.core.job.builder.SimpleJobBuilder incrementer(org.springframework.batch.core.JobParametersIncrementer) ,public org.springframework.batch.core.job...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutionStatus.java
FlowExecutionStatus
compareTo
class FlowExecutionStatus implements Comparable<FlowExecutionStatus> { /** * Special well-known status value. */ public static final FlowExecutionStatus COMPLETED = new FlowExecutionStatus(Status.COMPLETED.toString()); /** * Special well-known status value. */ public static final FlowExecutionStatus STOPP...
Status one = Status.match(this.name); Status two = Status.match(other.name); int comparison = one.compareTo(two); if (comparison == 0) { return this.name.compareTo(other.name); } return comparison;
822
75
897
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowJob.java
FlowJob
doExecute
class FlowJob extends AbstractJob { protected Flow flow; private final Map<String, Step> stepMap = new ConcurrentHashMap<>(); private volatile boolean initialized = false; /** * Create a {@link FlowJob} with null name and no flow (invalid state). */ public FlowJob() { super(); } /** * Create a {@lin...
try { JobFlowExecutor executor = new JobFlowExecutor(getJobRepository(), new SimpleStepHandler(getJobRepository()), execution); executor.updateJobExecutionStatus(flow.start(executor).getStatus()); } catch (FlowExecutionException e) { if (e.getCause() instanceof JobExecutionException) { throw (J...
586
129
715
<methods>public void <init>() ,public void <init>(java.lang.String) ,public void afterPropertiesSet() throws java.lang.Exception,public final void execute(org.springframework.batch.core.JobExecution) ,public org.springframework.batch.core.JobParametersIncrementer getJobParametersIncrementer() ,public org.springframewor...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowStep.java
FlowStep
doExecute
class FlowStep extends AbstractStep { private Flow flow; /** * Default constructor convenient for configuration purposes. */ public FlowStep() { super(null); } /** * Constructor for a {@link FlowStep} that sets the flow and of the step explicitly. * @param flow the {@link Flow} instance to be associat...
try { stepExecution.getExecutionContext().put(STEP_TYPE_KEY, this.getClass().getName()); StepHandler stepHandler = new SimpleStepHandler(getJobRepository(), stepExecution.getExecutionContext()); FlowExecutor executor = new JobFlowExecutor(getJobRepository(), stepHandler, stepExecution.getJobExecution()...
326
217
543
<methods>public void <init>() ,public void <init>(java.lang.String) ,public void afterPropertiesSet() throws java.lang.Exception,public final void execute(org.springframework.batch.core.StepExecution) throws org.springframework.batch.core.JobInterruptedException, org.springframework.batch.core.UnexpectedJobExecutionExc...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/JobFlowExecutor.java
JobFlowExecutor
executeStep
class JobFlowExecutor implements FlowExecutor { private final ThreadLocal<StepExecution> stepExecutionHolder = new ThreadLocal<>(); private final JobExecution execution; protected ExitStatus exitStatus = ExitStatus.EXECUTING; private final StepHandler stepHandler; private final JobRepository jobRepository; ...
boolean isRerun = isStepRestart(step); StepExecution stepExecution = stepHandler.handleStep(step, execution); stepExecutionHolder.set(stepExecution); if (stepExecution == null) { return ExitStatus.COMPLETED.getExitCode(); } if (stepExecution.isTerminateOnly()) { throw new JobInterruptedException("St...
788
170
958
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/DefaultStateTransitionComparator.java
DefaultStateTransitionComparator
compare
class DefaultStateTransitionComparator implements Comparator<StateTransition> { public static final String STATE_TRANSITION_COMPARATOR = "batch_state_transition_comparator"; @Override public int compare(StateTransition arg0, StateTransition arg1) {<FILL_FUNCTION_BODY>} }
String arg0Pattern = arg0.getPattern(); String arg1Pattern = arg1.getPattern(); if (arg0.getPattern().equals(arg1Pattern)) { return 0; } int arg0AsteriskCount = StringUtils.countOccurrencesOf(arg0Pattern, "*"); int arg1AsteriskCount = StringUtils.countOccurrencesOf(arg1Pattern, "*"); if (arg0AsteriskC...
84
442
526
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/StateTransition.java
StateTransition
toString
class StateTransition { private final State state; private final String pattern; private final String next; /** * @return the pattern the {@link ExitStatus#getExitCode()} will be compared against. */ public String getPattern() { return this.pattern; } /** * Create a new end state {@link StateTransit...
return String.format("StateTransition: [state=%s, pattern=%s, next=%s]", state == null ? null : state.getName(), pattern, next);
1,122
48
1,170
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/AbstractState.java
AbstractState
toString
class AbstractState implements State { private final String name; /** * @param name of the state. */ public AbstractState(String name) { this.name = name; } @Override public String getName() { return name; } @Override public String toString() {<FILL_FUNCTION_BODY>} @Override public abstract Flow...
return getClass().getSimpleName() + ": name=[" + name + "]";
113
25
138
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/EndState.java
EndState
handle
class EndState extends AbstractState { private final FlowExecutionStatus status; private final boolean abandon; private final String code; /** * @param status The {@link FlowExecutionStatus} to end with * @param name The name of the state */ public EndState(FlowExecutionStatus status, String name) { th...
synchronized (executor) { // Special case. If the last step execution could not complete we // are in an unknown state (possibly unrecoverable). StepExecution stepExecution = executor.getStepExecution(); if (stepExecution != null && executor.getStepExecution().getStatus() == BatchStatus.UNKNOWN) { ...
556
304
860
<methods>public void <init>(java.lang.String) ,public java.lang.String getName() ,public abstract org.springframework.batch.core.job.flow.FlowExecutionStatus handle(org.springframework.batch.core.job.flow.FlowExecutor) throws java.lang.Exception,public java.lang.String toString() <variables>private final non-sealed jav...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/MaxValueFlowExecutionAggregator.java
MaxValueFlowExecutionAggregator
aggregate
class MaxValueFlowExecutionAggregator implements FlowExecutionAggregator { /** * Aggregate all of the {@link FlowExecutionStatus}es of the {@link FlowExecution}s * into one status. The aggregate status will be the status with the highest * precedence. * * @see FlowExecutionAggregator#aggregate(Collection) ...
if (executions == null || executions.size() == 0) { return FlowExecutionStatus.UNKNOWN; } return Collections.max(executions).getStatus();
120
50
170
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/SplitState.java
SplitState
handle
class SplitState extends AbstractState implements FlowHolder { private final Collection<Flow> flows; private final SplitState parentSplit; private TaskExecutor taskExecutor = new SyncTaskExecutor(); private final FlowExecutionAggregator aggregator = new MaxValueFlowExecutionAggregator(); /** * @param flows ...
// TODO: collect the last StepExecution from the flows as well, so they // can be abandoned if necessary Collection<Future<FlowExecution>> tasks = new ArrayList<>(); for (final Flow flow : flows) { final FutureTask<FlowExecution> task = new FutureTask<>(() -> flow.start(executor)); tasks.add(task); ...
458
376
834
<methods>public void <init>(java.lang.String) ,public java.lang.String getName() ,public abstract org.springframework.batch.core.job.flow.FlowExecutionStatus handle(org.springframework.batch.core.job.flow.FlowExecutor) throws java.lang.Exception,public java.lang.String toString() <variables>private final non-sealed jav...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/StepState.java
StepState
handle
class StepState extends AbstractState implements StepLocator, StepHolder { private final Step step; /** * @param step the step that will be executed */ public StepState(Step step) { super(step.getName()); this.step = step; } /** * @param name for the step that will be executed * @param step the step...
/* * On starting a new step, possibly upgrade the last execution to make sure it is * abandoned on restart if it failed. */ executor.abandonStepExecution(); return new FlowExecutionStatus(executor.executeStep(step));
375
65
440
<methods>public void <init>(java.lang.String) ,public java.lang.String getName() ,public abstract org.springframework.batch.core.job.flow.FlowExecutionStatus handle(org.springframework.batch.core.job.flow.FlowExecutor) throws java.lang.Exception,public java.lang.String toString() <variables>private final non-sealed jav...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobOperatorFactoryBean.java
JobOperatorFactoryBean
afterPropertiesSet
class JobOperatorFactoryBean implements FactoryBean<JobOperator>, InitializingBean { private static final String TRANSACTION_ISOLATION_LEVEL_PREFIX = "ISOLATION_"; private static final String TRANSACTION_PROPAGATION_PREFIX = "PROPAGATION_"; private PlatformTransactionManager transactionManager; private Transact...
Assert.notNull(this.transactionManager, "TransactionManager must not be null"); Assert.notNull(this.jobLauncher, "JobLauncher must not be null"); Assert.notNull(this.jobRegistry, "JobRegistry must not be null"); Assert.notNull(this.jobExplorer, "JobExplorer must not be null"); Assert.notNull(this.jobReposito...
923
243
1,166
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunner.java
JobRegistryBackgroundJobRunner
main
class JobRegistryBackgroundJobRunner { /** * System property key that switches the runner to "embedded" mode (returning * immediately from the main method). Useful for testing purposes. */ public static final String EMBEDDED = JobRegistryBackgroundJobRunner.class.getSimpleName() + ".EMBEDDED"; private static...
Assert.state(args.length >= 1, "At least one argument (the parent context path) must be provided."); final JobRegistryBackgroundJobRunner launcher = new JobRegistryBackgroundJobRunner(args[0]); errors.clear(); if (logger.isInfoEnabled()) { logger.info("Starting job registry in parent context from XML at:...
1,298
515
1,813
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/RunIdIncrementer.java
RunIdIncrementer
getNext
class RunIdIncrementer implements JobParametersIncrementer { private static final String RUN_ID_KEY = "run.id"; private String key = RUN_ID_KEY; /** * The name of the run id in the job parameters. Defaults to "run.id". * @param key the key to set */ public void setKey(String key) { this.key = key; } /...
JobParameters params = (parameters == null) ? new JobParameters() : parameters; JobParameter<?> runIdParameter = params.getParameters().get(this.key); long id = 1; if (runIdParameter != null) { try { id = Long.parseLong(runIdParameter.getValue().toString()) + 1; } catch (NumberFormatException exc...
206
156
362
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/RuntimeExceptionTranslator.java
RuntimeExceptionTranslator
invoke
class RuntimeExceptionTranslator implements MethodInterceptor { @Override public Object invoke(MethodInvocation invocation) throws Throwable {<FILL_FUNCTION_BODY>} }
try { return invocation.proceed(); } catch (Exception e) { if (e.getClass().getName().startsWith("java")) { throw e; } throw new RuntimeException(e.getClass().getSimpleName() + ": " + e.getMessage()); }
48
85
133
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJobLauncher.java
SimpleJobLauncher
run
class SimpleJobLauncher implements JobLauncher, InitializingBean { protected static final Log logger = LogFactory.getLog(SimpleJobLauncher.class); private JobRepository jobRepository; private TaskExecutor taskExecutor; private MeterRegistry meterRegistry = Metrics.globalRegistry; private Counter jobLaunchCoun...
Assert.notNull(job, "The Job must not be null."); Assert.notNull(jobParameters, "The JobParameters must not be null."); if (this.jobLaunchCount != null) { this.jobLaunchCount.increment(); } final JobExecution jobExecution; JobExecution lastExecution = jobRepository.getLastJobExecution(job.getName(), j...
702
974
1,676
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapper.java
SimpleJvmExitCodeMapper
intValue
class SimpleJvmExitCodeMapper implements ExitCodeMapper { protected Log logger = LogFactory.getLog(getClass()); private final Map<String, Integer> mapping; public SimpleJvmExitCodeMapper() { mapping = new HashMap<>(); mapping.put(ExitStatus.COMPLETED.getExitCode(), JVM_EXITCODE_COMPLETED); mapping.put(ExitS...
Integer statusCode = null; try { statusCode = mapping.get(exitCode); } catch (RuntimeException ex) { // We still need to return an exit code, even if there is an issue // with // the mapper. logger.fatal("Error mapping exit code, generic exit status returned.", ex); } return (statusCode !...
382
125
507
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/listener/AbstractListenerFactoryBean.java
AbstractListenerFactoryBean
getObject
class AbstractListenerFactoryBean<T> implements FactoryBean<Object>, InitializingBean { private static final Log logger = LogFactory.getLog(AbstractListenerFactoryBean.class); private Object delegate; private Map<String, String> metaDataMap; @Override public Object getObject() {<FILL_FUNCTION_BODY>} protecte...
if (metaDataMap == null) { metaDataMap = new HashMap<>(); } // Because all annotations and interfaces should be checked for, make // sure that each meta data // entry is represented. for (ListenerMetaData metaData : this.getMetaDataValues()) { if (!metaDataMap.containsKey(metaData.getPropertyName()))...
747
915
1,662
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeChunkListener.java
CompositeChunkListener
afterChunk
class CompositeChunkListener implements ChunkListener { private final OrderedComposite<ChunkListener> listeners = new OrderedComposite<>(); /** * Default constructor */ public CompositeChunkListener() { } /** * Convenience constructor for setting the {@link ChunkListener}s. * @param listeners list of {...
for (Iterator<ChunkListener> iterator = listeners.reverse(); iterator.hasNext();) { ChunkListener listener = iterator.next(); listener.afterChunk(context); }
645
57
702
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemProcessListener.java
CompositeItemProcessListener
afterProcess
class CompositeItemProcessListener<T, S> implements ItemProcessListener<T, S> { private final OrderedComposite<ItemProcessListener<? super T, ? super S>> listeners = new OrderedComposite<>(); /** * Public setter for the listeners. * @param itemProcessorListeners list of {@link ItemProcessListener}s to be called...
for (Iterator<ItemProcessListener<? super T, ? super S>> iterator = listeners.reverse(); iterator.hasNext();) { ItemProcessListener<? super T, ? super S> listener = iterator.next(); listener.afterProcess(item, result); }
622
75
697
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemReadListener.java
CompositeItemReadListener
beforeRead
class CompositeItemReadListener<T> implements ItemReadListener<T> { private final OrderedComposite<ItemReadListener<? super T>> listeners = new OrderedComposite<>(); /** * Public setter for the listeners. * @param itemReadListeners list of {@link ItemReadListener}s to be called when read * events occur. */ ...
for (Iterator<ItemReadListener<? super T>> iterator = listeners.iterator(); iterator.hasNext();) { ItemReadListener<? super T> listener = iterator.next(); listener.beforeRead(); }
551
62
613
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemWriteListener.java
CompositeItemWriteListener
onWriteError
class CompositeItemWriteListener<S> implements ItemWriteListener<S> { private final OrderedComposite<ItemWriteListener<? super S>> listeners = new OrderedComposite<>(); /** * Public setter for the listeners. * @param itemWriteListeners list of {@link ItemWriteListener}s to be called when * write events occur....
for (Iterator<ItemWriteListener<? super S>> iterator = listeners.reverse(); iterator.hasNext();) { ItemWriteListener<? super S> listener = iterator.next(); listener.onWriteError(ex, items); }
549
68
617
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeJobExecutionListener.java
CompositeJobExecutionListener
afterJob
class CompositeJobExecutionListener implements JobExecutionListener { private final OrderedComposite<JobExecutionListener> listeners = new OrderedComposite<>(); /** * Public setter for the listeners. * @param listeners list of {@link JobExecutionListener}s to be called when job * execution events occur. */ ...
for (Iterator<JobExecutionListener> iterator = listeners.reverse(); iterator.hasNext();) { JobExecutionListener listener = iterator.next(); listener.afterJob(jobExecution); }
398
57
455
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeSkipListener.java
CompositeSkipListener
onSkipInRead
class CompositeSkipListener<T, S> implements SkipListener<T, S> { private final OrderedComposite<SkipListener<? super T, ? super S>> listeners = new OrderedComposite<>(); /** * Public setter for the listeners. * @param listeners list of {@link SkipListener}s to be called when skip events occur. */ public voi...
for (Iterator<SkipListener<? super T, ? super S>> iterator = listeners.iterator(); iterator.hasNext();) { SkipListener<? super T, ? super S> listener = iterator.next(); listener.onSkipInRead(t); }
611
72
683
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeStepExecutionListener.java
CompositeStepExecutionListener
afterStep
class CompositeStepExecutionListener implements StepExecutionListener { private final OrderedComposite<StepExecutionListener> list = new OrderedComposite<>(); /** * Public setter for the listeners. * @param listeners list of {@link StepExecutionListener}s to be called when step * execution events occur. */ ...
for (Iterator<StepExecutionListener> iterator = list.reverse(); iterator.hasNext();) { StepExecutionListener listener = iterator.next(); ExitStatus close = listener.afterStep(stepExecution); stepExecution.setExitStatus(stepExecution.getExitStatus().and(close)); } return stepExecution.getExitStatus();
390
91
481
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/listener/ExecutionContextPromotionListener.java
ExecutionContextPromotionListener
afterPropertiesSet
class ExecutionContextPromotionListener implements StepExecutionListener, InitializingBean { private String[] keys = null; private String[] statuses = new String[] { ExitStatus.COMPLETED.getExitCode() }; private boolean strict = false; @Nullable @Override public ExitStatus afterStep(StepExecution stepExecutio...
Assert.state(this.keys != null, "The 'keys' property must be provided"); Assert.state(!ObjectUtils.isEmpty(this.keys), "The 'keys' property must not be empty"); Assert.state(this.statuses != null, "The 'statuses' property must be provided"); Assert.state(!ObjectUtils.isEmpty(this.statuses), "The 'statuses' pro...
511
109
620
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobListenerFactoryBean.java
JobListenerFactoryBean
getListener
class JobListenerFactoryBean extends AbstractListenerFactoryBean<JobExecutionListener> { @Override protected ListenerMetaData getMetaDataFromPropertyName(String propertyName) { return JobListenerMetaData.fromPropertyName(propertyName); } @Override protected ListenerMetaData[] getMetaDataValues() { return Job...
JobListenerFactoryBean factory = new JobListenerFactoryBean(); factory.setDelegate(delegate); return (JobExecutionListener) factory.getObject();
340
43
383
<methods>public non-sealed void <init>() ,public void afterPropertiesSet() throws java.lang.Exception,public java.lang.Object getObject() ,public static boolean isListener(java.lang.Object, Class<?>, org.springframework.batch.core.listener.ListenerMetaData[]) ,public boolean isSingleton() ,public void setDelegate(java....
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobParameterExecutionContextCopyListener.java
JobParameterExecutionContextCopyListener
beforeStep
class JobParameterExecutionContextCopyListener implements StepExecutionListener { private Collection<String> keys = null; /** * @param keys A list of keys corresponding to items in the {@link JobParameters} that * should be copied. */ public void setKeys(String[] keys) { this.keys = Arrays.asList(keys); }...
ExecutionContext stepContext = stepExecution.getExecutionContext(); JobParameters jobParameters = stepExecution.getJobParameters(); Collection<String> keys = this.keys; if (keys == null) { keys = jobParameters.getParameters().keySet(); } for (String key : keys) { if (!stepContext.containsKey(key)) { ...
197
123
320
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/listener/MethodInvokerMethodInterceptor.java
MethodInvokerMethodInterceptor
invoke
class MethodInvokerMethodInterceptor implements MethodInterceptor { private final Map<String, Set<MethodInvoker>> invokerMap; private final boolean ordered; public MethodInvokerMethodInterceptor(Map<String, Set<MethodInvoker>> invokerMap) { this(invokerMap, false); } public MethodInvokerMethodInterceptor(Map...
String methodName = invocation.getMethod().getName(); if (ordered && methodName.equals("getOrder")) { return invocation.proceed(); } Set<MethodInvoker> invokers = invokerMap.get(methodName); if (invokers == null) { return null; } ExitStatus status = null; for (MethodInvoker invoker : invokers)...
266
221
487
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/listener/OrderedComposite.java
OrderedComposite
add
class OrderedComposite<S> { private final List<S> unordered = new ArrayList<>(); private final List<S> ordered = new ArrayList<>(); private final Comparator<? super S> comparator = new AnnotationAwareOrderComparator(); private final List<S> list = new ArrayList<>(); /** * Public setter for the listeners. ...
if (item instanceof Ordered) { if (!ordered.contains(item)) { ordered.add(item); } } else if (AnnotationUtils.isAnnotationDeclaredLocally(Order.class, item.getClass())) { if (!ordered.contains(item)) { ordered.add(item); } } else if (!unordered.contains(item)) { unordered.add(item); ...
374
155
529
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFactoryBean.java
StepListenerFactoryBean
getListener
class StepListenerFactoryBean extends AbstractListenerFactoryBean<StepListener> { @Override protected ListenerMetaData getMetaDataFromPropertyName(String propertyName) { return StepListenerMetaData.fromPropertyName(propertyName); } @Override protected ListenerMetaData[] getMetaDataValues() { return StepListe...
StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(delegate); return (StepListener) factory.getObject();
335
42
377
<methods>public non-sealed void <init>() ,public void afterPropertiesSet() throws java.lang.Exception,public java.lang.Object getObject() ,public static boolean isListener(java.lang.Object, Class<?>, org.springframework.batch.core.listener.ListenerMetaData[]) ,public boolean isSingleton() ,public void setDelegate(java....
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/observability/BatchMetrics.java
BatchMetrics
formatDuration
class BatchMetrics { public static final String METRICS_PREFIX = "spring.batch."; public static final String STATUS_SUCCESS = "SUCCESS"; public static final String STATUS_FAILURE = "FAILURE"; private BatchMetrics() { } /** * Create a {@link Timer}. * @param meterRegistry the meter registry to use * @pa...
if (duration == null || duration.isZero() || duration.isNegative()) { return ""; } StringBuilder formattedDuration = new StringBuilder(); long hours = duration.toHours(); long minutes = duration.toMinutes(); long seconds = duration.getSeconds(); long millis = duration.toMillis(); if (hours != 0) { ...
1,215
255
1,470
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/observability/DefaultBatchJobObservationConvention.java
DefaultBatchJobObservationConvention
getLowCardinalityKeyValues
class DefaultBatchJobObservationConvention implements BatchJobObservationConvention { @Override public KeyValues getLowCardinalityKeyValues(BatchJobContext context) {<FILL_FUNCTION_BODY>} @Override public KeyValues getHighCardinalityKeyValues(BatchJobContext context) { JobExecution execution = context.getJobExe...
JobExecution execution = context.getJobExecution(); return KeyValues.of( BatchJobObservation.JobLowCardinalityTags.JOB_NAME.withValue(execution.getJobInstance().getJobName()), BatchJobObservation.JobLowCardinalityTags.JOB_STATUS .withValue(execution.getExitStatus().getExitCode()));
183
92
275
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/observability/DefaultBatchStepObservationConvention.java
DefaultBatchStepObservationConvention
getLowCardinalityKeyValues
class DefaultBatchStepObservationConvention implements BatchStepObservationConvention { @Override public KeyValues getLowCardinalityKeyValues(BatchStepContext context) {<FILL_FUNCTION_BODY>} @Override public KeyValues getHighCardinalityKeyValues(BatchStepContext context) { StepExecution execution = context.getS...
StepExecution execution = context.getStepExecution(); return KeyValues.of(BatchStepObservation.StepLowCardinalityTags.STEP_NAME.withValue(execution.getStepName()), BatchStepObservation.StepLowCardinalityTags.JOB_NAME .withValue(execution.getJobExecution().getJobInstance().getJobName()), BatchStepObser...
137
124
261
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/AbstractPartitionHandler.java
AbstractPartitionHandler
handle
class AbstractPartitionHandler implements PartitionHandler { protected int gridSize = 1; /** * Executes the specified {@link StepExecution} instances and returns an updated view * of them. Throws an {@link Exception} if anything goes wrong. * @param managerStepExecution the whole partition execution * @para...
final Set<StepExecution> stepExecutions = stepSplitter.split(managerStepExecution, gridSize); return doHandle(managerStepExecution, stepExecutions);
437
44
481
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/DefaultStepExecutionAggregator.java
DefaultStepExecutionAggregator
aggregate
class DefaultStepExecutionAggregator implements StepExecutionAggregator { /** * Aggregates the input executions into the result {@link StepExecution}. The * aggregated fields are * <ul> * <li>status - choosing the highest value using * {@link BatchStatus#max(BatchStatus, BatchStatus)}</li> * <li>exitStatu...
Assert.notNull(result, "To aggregate into a result it must be non-null."); if (executions == null) { return; } for (StepExecution stepExecution : executions) { BatchStatus status = stepExecution.getStatus(); result.setStatus(BatchStatus.max(result.getStatus(), status)); result.setExitStatus(result....
197
318
515
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/MultiResourcePartitioner.java
MultiResourcePartitioner
partition
class MultiResourcePartitioner implements Partitioner { private static final String DEFAULT_KEY_NAME = "fileName"; private static final String PARTITION_KEY = "partition"; private Resource[] resources = new Resource[0]; private String keyName = DEFAULT_KEY_NAME; /** * The resources to assign to each partiti...
Map<String, ExecutionContext> map = new HashMap<>(gridSize); int i = 0; for (Resource resource : resources) { ExecutionContext context = new ExecutionContext(); Assert.state(resource.exists(), "Resource does not exist: " + resource); try { context.putString(keyName, resource.getURL().toExternalForm(...
284
165
449
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/PartitionStep.java
PartitionStep
doExecute
class PartitionStep extends AbstractStep { private StepExecutionSplitter stepExecutionSplitter; private PartitionHandler partitionHandler; private StepExecutionAggregator stepExecutionAggregator = new DefaultStepExecutionAggregator(); /** * A {@link PartitionHandler} which can send out step executions for rem...
stepExecution.getExecutionContext().put(STEP_TYPE_KEY, this.getClass().getName()); // Wait for task completion and then aggregate the results Collection<StepExecution> executions = partitionHandler.handle(stepExecutionSplitter, stepExecution); stepExecution.upgradeStatus(BatchStatus.COMPLETED); stepExecutio...
636
154
790
<methods>public void <init>() ,public void <init>(java.lang.String) ,public void afterPropertiesSet() throws java.lang.Exception,public final void execute(org.springframework.batch.core.StepExecution) throws org.springframework.batch.core.JobInterruptedException, org.springframework.batch.core.UnexpectedJobExecutionExc...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/RemoteStepExecutionAggregator.java
RemoteStepExecutionAggregator
aggregate
class RemoteStepExecutionAggregator implements StepExecutionAggregator, InitializingBean { private StepExecutionAggregator delegate = new DefaultStepExecutionAggregator(); private JobExplorer jobExplorer; /** * Create a new instance (useful for configuration purposes). */ public RemoteStepExecutionAggregator...
Assert.notNull(result, "To aggregate into a result it must be non-null."); if (executions == null) { return; } Set<Long> stepExecutionIds = executions.stream().map(stepExecution -> { Long id = stepExecution.getId(); Assert.state(id != null, "StepExecution has null id. It must be saved first: " + stepE...
418
251
669
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/SimplePartitioner.java
SimplePartitioner
partition
class SimplePartitioner implements Partitioner { private static final String PARTITION_KEY = "partition"; @Override public Map<String, ExecutionContext> partition(int gridSize) {<FILL_FUNCTION_BODY>} }
Map<String, ExecutionContext> map = new HashMap<>(gridSize); for (int i = 0; i < gridSize; i++) { map.put(PARTITION_KEY + i, new ExecutionContext()); } return map;
60
69
129
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/TaskExecutorPartitionHandler.java
TaskExecutorPartitionHandler
doHandle
class TaskExecutorPartitionHandler extends AbstractPartitionHandler implements StepHolder, InitializingBean { private TaskExecutor taskExecutor = new SyncTaskExecutor(); private Step step; @Override public void afterPropertiesSet() throws Exception { Assert.state(step != null, "A Step must be provided."); } ...
Assert.notNull(step, "A Step must be provided."); final Set<Future<StepExecution>> tasks = new HashSet<>(getGridSize()); final Set<StepExecution> result = new HashSet<>(); for (final StepExecution stepExecution : partitionStepExecutions) { final FutureTask<StepExecution> task = createTask(step, stepExecuti...
483
285
768
<methods>public non-sealed void <init>() ,public int getGridSize() ,public Collection<org.springframework.batch.core.StepExecution> handle(org.springframework.batch.core.partition.StepExecutionSplitter, org.springframework.batch.core.StepExecution) throws java.lang.Exception,public void setGridSize(int) <variables>prot...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/DefaultExecutionContextSerializer.java
DefaultExecutionContextSerializer
serialize
class DefaultExecutionContextSerializer implements ExecutionContextSerializer { /** * Serializes an execution context to the provided {@link OutputStream}. The stream is * not closed prior to it's return. * @param context {@link Map} contents of the {@code ExecutionContext}. * @param out {@link OutputStream} ...
Assert.notNull(context, "context is required"); Assert.notNull(out, "OutputStream is required"); for (Object value : context.values()) { Assert.notNull(value, "A null value was found"); if (!(value instanceof Serializable)) { throw new IllegalArgumentException( "Value: [" + value + "] must be se...
351
220
571
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/AbstractJobRepositoryFactoryBean.java
AbstractJobRepositoryFactoryBean
afterPropertiesSet
class AbstractJobRepositoryFactoryBean implements FactoryBean<JobRepository>, InitializingBean { private PlatformTransactionManager transactionManager; private TransactionAttributeSource transactionAttributeSource; private final ProxyFactory proxyFactory = new ProxyFactory(); private String isolationLevelForCre...
Assert.state(transactionManager != null, "TransactionManager must not be null."); if (this.transactionAttributeSource == null) { Properties transactionAttributes = new Properties(); transactionAttributes.setProperty("create*", TRANSACTION_PROPAGATION_PREFIX + Propagation.REQUIRES_NEW + "," + this.isolat...
1,555
209
1,764
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/resource/StepExecutionSimpleCompletionPolicy.java
StepExecutionSimpleCompletionPolicy
start
class StepExecutionSimpleCompletionPolicy implements StepExecutionListener, CompletionPolicy { private CompletionPolicy delegate; private String keyName = "commit.interval"; /** * Public setter for the key name of a Long value in the {@link JobParameters} that * will contain a commit interval. Defaults to "co...
Assert.state(delegate != null, "The delegate resource has not been initialised. " + "Remember to register this object as a StepListener."); return delegate.start(parent);
806
51
857
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/scope/BatchScopeSupport.java
BatchScopeSupport
postProcessBeanFactory
class BatchScopeSupport implements Scope, BeanFactoryPostProcessor, Ordered { private boolean autoProxy = true; private boolean proxyTargetClass = false; private String name; private int order = Ordered.LOWEST_PRECEDENCE; /** * @param order the order value to set priority of callback execution for the * {...
beanFactory.registerScope(name, this); if (!autoProxy) { return; } Assert.state(beanFactory instanceof BeanDefinitionRegistry, "BeanFactory was not a BeanDefinitionRegistry, so JobScope cannot be used."); BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory; for (String beanNam...
1,264
262
1,526
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/scope/JobScope.java
JobScope
registerDestructionCallback
class JobScope extends BatchScopeSupport { private static final String TARGET_NAME_PREFIX = "jobScopedTarget."; private final Log logger = LogFactory.getLog(getClass()); private final Object mutex = new Object(); /** * Context key for clients to use for conversation identifier. */ public static final Strin...
JobContext context = getContext(); if (logger.isDebugEnabled()) { logger.debug(String.format("Registered destruction callback in scope=%s, name=%s", this.getName(), name)); } context.registerDestructionCallback(name, callback);
767
73
840
<methods>public non-sealed void <init>() ,public java.lang.String getName() ,public int getOrder() ,public abstract java.lang.String getTargetNamePrefix() ,public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory) throws org.springframework.beans.BeansException,public ...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/scope/StepScope.java
StepScope
registerDestructionCallback
class StepScope extends BatchScopeSupport { private static final String TARGET_NAME_PREFIX = "scopedTarget."; private final Log logger = LogFactory.getLog(getClass()); private final Object mutex = new Object(); /** * Context key for clients to use for conversation identifier. */ public static final String ...
StepContext context = getContext(); if (logger.isDebugEnabled()) { logger.debug(String.format("Registered destruction callback in scope=%s, name=%s", this.getName(), name)); } context.registerDestructionCallback(name, callback);
766
73
839
<methods>public non-sealed void <init>() ,public java.lang.String getName() ,public int getOrder() ,public abstract java.lang.String getTargetNamePrefix() ,public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory) throws org.springframework.beans.BeansException,public ...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobContext.java
JobContext
toString
class JobContext extends SynchronizedAttributeAccessor { private final JobExecution jobExecution; private final Map<String, Set<Runnable>> callbacks = new HashMap<>(); public JobContext(JobExecution jobExecution) { super(); Assert.notNull(jobExecution, "A JobContext must have a non-null JobExecution"); this...
return super.toString() + ", jobExecutionContext=" + getJobExecutionContext() + ", jobParameters=" + getJobParameters();
1,367
36
1,403
<methods>public non-sealed void <init>() ,public java.lang.String[] attributeNames() ,public boolean equals(java.lang.Object) ,public java.lang.Object getAttribute(java.lang.String) ,public boolean hasAttribute(java.lang.String) ,public int hashCode() ,public java.lang.Object removeAttribute(java.lang.String) ,public v...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobScopeManager.java
JobScopeManager
execute
class JobScopeManager { @Around("execution(void org.springframework.batch.core.Job+.execute(*)) && target(job) && args(jobExecution)") public void execute(Job job, JobExecution jobExecution) {<FILL_FUNCTION_BODY>} }
JobSynchronizationManager.register(jobExecution); try { job.execute(jobExecution); } finally { JobSynchronizationManager.release(); }
70
55
125
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContext.java
StepContext
getJobInstanceId
class StepContext extends SynchronizedAttributeAccessor { private final StepExecution stepExecution; private final Map<String, Set<Runnable>> callbacks = new HashMap<>(); /** * Create a new instance of {@link StepContext} for this {@link StepExecution}. * @param stepExecution a step execution */ public Ste...
Assert.state(stepExecution.getJobExecution() != null, "StepExecution does not have a JobExecution"); Assert.state(stepExecution.getJobExecution().getJobInstance() != null, "StepExecution does not have a JobInstance"); return stepExecution.getJobExecution().getJobInstance().getInstanceId();
1,731
82
1,813
<methods>public non-sealed void <init>() ,public java.lang.String[] attributeNames() ,public boolean equals(java.lang.Object) ,public java.lang.Object getAttribute(java.lang.String) ,public boolean hasAttribute(java.lang.String) ,public int hashCode() ,public java.lang.Object removeAttribute(java.lang.String) ,public v...
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContextRepeatCallback.java
StepContextRepeatCallback
doInIteration
class StepContextRepeatCallback implements RepeatCallback { private final Queue<ChunkContext> attributeQueue = new LinkedBlockingQueue<>(); private final StepExecution stepExecution; private final Log logger = LogFactory.getLog(StepContextRepeatCallback.class); /** * @param stepExecution instance of {@link St...
// The StepContext has to be the same for all chunks, // otherwise step-scoped beans will be re-initialised for each chunk. StepContext stepContext = StepSynchronizationManager.register(stepExecution); if (logger.isDebugEnabled()) { logger.debug("Preparing chunk execution for StepContext: " + ObjectUtils.i...
508
271
779
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepScopeManager.java
StepScopeManager
execute
class StepScopeManager { @Around("execution(void org.springframework.batch.core.Step+.execute(*)) && target(step) && args(stepExecution)") public void execute(Step step, StepExecution stepExecution) throws JobInterruptedException {<FILL_FUNCTION_BODY>} }
StepSynchronizationManager.register(stepExecution); try { step.execute(stepExecution); } finally { StepSynchronizationManager.release(); }
75
55
130
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/SynchronizationManagerSupport.java
SynchronizationManagerSupport
increment
class SynchronizationManagerSupport<E, C> { /* * We have to deal with single and multi-threaded execution, with a single and with * multiple step execution instances. That's 2x2 = 4 scenarios. */ /** * Storage for the current execution; has to be ThreadLocal because it is needed to * locate a context in c...
E current = getCurrent().peek(); if (current != null) { AtomicInteger count; synchronized (counts) { count = counts.get(current); if (count == null) { count = new AtomicInteger(); counts.put(current, count); } } count.incrementAndGet(); }
1,070
104
1,174
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/step/NoWorkFoundStepExecutionListener.java
NoWorkFoundStepExecutionListener
afterStep
class NoWorkFoundStepExecutionListener implements StepExecutionListener { @Nullable @Override public ExitStatus afterStep(StepExecution stepExecution) {<FILL_FUNCTION_BODY>} }
if (stepExecution.getReadCount() == 0) { return ExitStatus.FAILED; } return null;
49
37
86
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/step/ThreadStepInterruptionPolicy.java
ThreadStepInterruptionPolicy
checkInterrupted
class ThreadStepInterruptionPolicy implements StepInterruptionPolicy { protected static final Log logger = LogFactory.getLog(ThreadStepInterruptionPolicy.class); /** * Returns if the current job lifecycle has been interrupted by checking if the * current thread is interrupted. */ @Override public void check...
if (isInterrupted(stepExecution)) { throw new JobInterruptedException("Job interrupted status detected."); }
239
35
274
<no_super_class>
spring-projects_spring-batch
spring-batch/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/FlowStepBuilder.java
FlowStepBuilder
build
class FlowStepBuilder extends StepBuilderHelper<FlowStepBuilder> { private Flow flow; /** * Create a new builder initialized with any properties in the parent. The parent is * copied, so it can be re-used. * @param parent a parent helper containing common step properties */ public FlowStepBuilder(StepBuild...
FlowStep step = new FlowStep(); step.setName(getName()); step.setFlow(flow); super.enhance(step); try { step.afterPropertiesSet(); } catch (Exception e) { throw new StepBuilderException(e); } return step;
262
90
352
<methods>public void <init>(java.lang.String) ,public void <init>(java.lang.String, org.springframework.batch.core.repository.JobRepository) ,public org.springframework.batch.core.step.builder.FlowStepBuilder allowStartIfComplete(boolean) ,public org.springframework.batch.core.step.builder.FlowStepBuilder listener(java...