Closed Juljan closed 4 years ago
Good point to raise. The spec is not clear here.
The transaction around open()
is managed by the batch impl, like the chunk-by-chunk transactions. It could be useful to allow the application some way to influence this.
I don't think there's a clear, obvious fix here, though.
If we don't think there's a need to set a separate timeout around open/close vs. the chunk-by-chunk timeout, we could start by looking at javax.transaction.global.timeout
, and possibly ask if we should also call CheckpointAlgorithm.checkpointTimeout()
first.
I recognize there's an asymmetry here in that the chunk-by-chunk timeouts will have been set on the thread by the time close()
is called, unlike open()
.
Given that the existing behavior is well-defined, though, I would not want to risk breaking anyone by changing the behavior to, say, all of a sudden start using the javax.transaction.global.timeout
value.
I'd like to leave this open, and possibly consider it as an issue against the spec, going forwards.
In the meantime, I think you could workaround this for a non-partitioned step by using StepListener.beforeStep()
and setting the transaction timeout on the thread.
I'm closing this issue here.
@Juljan feel free to open an issue at https://github.com/eclipse-ee4j/batch-api if you are still interested in this item. Thank you.
Hello,
There seems to have no way to override the Application Server default timeout for the open() method of the reader.
The following property from the job description xml is not considered for open() :
If think that
ChunkStepControllerImpl.invokeChunk()
should calluserTransaction.setTransactionTimeout()
with the property value before thetransactionManager.begin();
that precedesthis.openReaderAndWriter();
.To reproduce, just add some Thread.sleep() with a value higher than the application server default JTA timeout and you will see some logs and then an exception when the checkpoint is persisted.