Skip to content

AbstractCursorItemReader doClose() method is not reentrant [BATCH-2737] #868

Closed
@spring-projects-issues

Description

@spring-projects-issues

Tommy opened BATCH-2737 and commented

The following warning coming up from the DisposableBeanAdapter, when it tries to destroy any reader extended from the AbstractCursorItemReader by the auto-discovered close() method.
DisposableBeanAdapter : Invocation of destroy method 'close' failed on bean with name 'reader': org.springframework.batch.item.ItemStreamException: Error while closing item reader

Since the invocation of the close() method is already part of the Spring-Batch life-cycle, the doClose() method of this class should be reentrant.
The problem lies in the incomplete check around resetting the autoCommit state of the underlying connection, which does not respect the already closed connection.

The check should look like something similar

if(this.con != null && !this.conn.isClosed()) {
	this.con.setAutoCommit(this.initialConnectionAutoCommit);
}

Affects: 4.0.0

1 votes, 2 watchers

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions