Bug 5383 - Support @PostConstruct and @PreDestroy callbacks in batch artifacts
Support @PostConstruct and @PreDestroy callbacks in batch artifacts
Status: NEW
Product: jbatch
Classification: Unclassified
Component: SPEC
All All
: P5 enhancement
: ---
Assigned To: ScottKurz
Depends on:
  Show dependency treegraph
Reported: 2013-09-11 15:30 UTC by cf126330
Modified: 2015-10-01 13:47 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description cf126330 2013-09-11 15:30:26 UTC
PostConstruct and PreDestroy callbacks enable applications to influence how batch container manages batch artifact lifecycles.  Both classes are in already Java SE 6:


For example,

private void checkData() throws BatchRuntimeException {
  //make sure all injected properties are in place and valid.
  //do the necessary data conversion from string properties to other types
  //or consolidate several properties into 1
  //or other initialization work

void cleanUp() {
  //clean up 

Currently there is no portable way to perform init and cleanup work in a batch artifact.  So applications have to do it at the beginning of business processing methods, and have to take care to only perform it once.