Bug 4554 - Passing data around during a batch run and BatchContext's transient data
Passing data around during a batch run and BatchContext's transient data
Status: RESOLVED WORKSFORME
Product: jbatch
Classification: Unclassified
Component: source
1
All All
: P5 normal
: ---
Assigned To: cvignola
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-18 15:08 UTC by mminella
Modified: 2013-03-01 18:50 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mminella 2013-01-18 15:08:09 UTC
In section 7.8.1 on page 90, the BatchContext is defined.  Is there any way for me to store information in it?  Say for example, I have a job that I want to pass information from one step to the next in.  In Spring Batch, you can do that by using the ExecutionContext on the JobExeuction.  Also, what is the intended use of the "transient user data"?  If this is intended as a way for users to store information during a run, I would think that you would set some form of key/value relationship and retrieve that data via a key...
Comment 1 cf126330 2013-01-18 15:50:58 UTC
I also feel key-value pair is the common mechanism for storing and passing contextual information.  Examples in EE are ServletContext.setAttribute, getAttribute.  So a Map<?, ?> in BatchContext would be nice.

In the current form, BatchContext<T> lets user choose the actual T type for transient data, and P type for persistent data. As a result any impl classes would also bear these user defined types, which I think is a bit too tight coupled.
Comment 2 cvignola 2013-01-23 21:51:41 UTC
1) Yes, the batch context transient data is intended for sharing between steps.

2) I agree changing it to Map<?,?> is a good idea.
Comment 3 cvignola 2013-03-01 18:12:19 UTC
Let me clarify:  The JobContext transient area is meant for sharing among steps.

For transient data, the user must still specify type <T>,  but user can choose the convention and specify Java types, such as HashMap<String,String>.

For persistent data, the user must specify <P extends Serializable>, which allows more choices, including simple types, HashMap, and even Externalizable.
Comment 4 cvignola 2013-03-01 18:50:03 UTC
Changing this bug resolution "worksforme" since no change is being made in response to this bug.  The change of Externalizable to Serializable is already being done by Bug 4679.