Announcement Announcement Module
Collapse
No announcement yet.
Step not completing stays 'started' Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Step not completing stays 'started'

    I am using Springbatch 2.03 and upgrading is not an option at the moment.

    I must be doing something fundamentally wrong, as I cannot find anyone else who had this exact problem.

    I created a single threaded batch which uses a JdbcCursorItemReader(extended locally to overcome the parameter replacement bug in 2.03) to read from a table and then a Writer to call an EJB to process the item and save the result in a table. The cursor picks up all records which do not have a value yet. This all works perfectly but slowly.

    The EJB call has plenty wait time so multithreading it will bring a lot of speed improvement so I tried the simplest approach to multithreading the step. I just added a org.springframework.core.task.SimpleAsyncTaskExecu tor as a task-executor to the step.

    It now runs A LOT faster but the step does not complete. After processessing all the items it stays started and does nothing. I can see the CPU coming down and nothing happens in the log any more but the step stays in the STARTED state and the batch do not progress to the next step.

    Any help will be much appreciated.

    Code:
     		<step id="extractStatementData" next="createStatements">
    			<tasklet allow-start-if-complete="true" >
    				<chunk reader="extractStatementDataReader" writer="extractStatementDataWriter" commit-interval="1" skip-limit="10" task-executor="taskExecutor">
    					<skippable-exception-classes>
    						java.lang.Exception
    					</skippable-exception-classes>
    				</chunk>	
    			</tasklet>
    		</step>		
    
    
    	<beans:bean id="extractStatementDataReader" class="batch.jobs.statements.ExtractStatementDataReader" scope="step">
    		<beans:property name="statementDAO" ref="statementDAO"/>
    		<beans:property name="dataSource" ref="dataSource"/>
    		<beans:property name="saveState" value="false"/>
    		<beans:property name="sql" value="SELECT * FROM WEALTH_BATCH.STATEMENTREQUEST WHERE STATEMENTID IS NULL AND PROCESSED = 0 AND JOBID = ? WITH CS"/>
    		<beans:property name="rowMapper">
    			<beans:bean class="batch.jobs.statements.StatementRequestDtoMapper"/>
    		</beans:property>
    	</beans:bean>

  • #2
    Is the JVM still alive? Did you accidentally add the task executor to your JobLauncher as well?

    Comment


    • #3
      Thank you for your reply, I appreciate it very much.

      The JVM is still alive because the Springframework runs within Websphere 6.1. Batches are started as WorkThreads so the container will notify the thread when the server is going down or the app is being undeployed.

      I have not checked whether the thread dies or not so I will check that out.

      I did not add the executor anywhere else. I just configured the bean with no parameters and added it to the chunk portion of the step. I see that in later versions of the framework the configuration sits on the tasklet?

      I was wondering if I should configure something else that collates the async executions so the framework knows all the threads have completed. It looks like the threads are started but the step does not realise they are complete.

      Comment


      • #4
        Maybe the threads are blocked? Can you see them all? With 2.0 you need to make sure your thread pool and the throttle setting in the step is no larger than your JDBC connection pool.

        Comment

        Working...
        X