Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide exit code for job executed as a main method [BATCH-24] #3551

Closed
spring-projects-issues opened this issue Jun 19, 2007 · 6 comments
Closed

Comments

@spring-projects-issues
Copy link
Collaborator

Dave Syer opened BATCH-24 and commented

Provide exit code for job executed as a main method. Some strategy to allow operators / configuration to override and add error codes, e.g. mapped to exception types.


Affects: 1.0-m1

Attachments:

Issue Links:

  • BATCH-45 Create a POJO adapter for batch Tasklet
    ("is depended on by")

  • BATCH-40 An application developer must be able to control the 'exit codes' returned by the container

  • BATCH-14 Create efficient framework for launching / bootstrapping jobs in the common case of just launching a main method.

1 votes, 2 watchers

@spring-projects-issues
Copy link
Collaborator Author

Dave Syer commented

ExitStatus from job execution could be correlated with BatchStatus as a sensible default. E.g. COMPLETED=0, FAILED=1, ... Currently it is just 0 (success), 1 (fail). The ExitStatus is only used for the exit code at the moment as well - there is room in the DDL for a message - so the whole exit status could be included in the database.

@spring-projects-issues
Copy link
Collaborator Author

Stijn Maller commented

In the scope of our project we have implemented a few classes that do exactly what is described in this issue. I uploaded them as requested by Lucas Ward. We do depend on a few features of Java 5 which might be a problem for including it in spring-batch? (shouldn't be too hard to change that part of the code if needed)

@spring-projects-issues
Copy link
Collaborator Author

Lucas Ward commented

I committed code that addresses this issue, based upon some of the code submitted by Stijn, and earlier code put in to fix BATCH-40. However, there still needs to be some polish applied (clean up java docs, etc), and I can't figure out a decent way to test the BatchCommandLineLauncher, since it makes a call to System.exit(). I'll finish it up tomorrow and mark as fixed.

@spring-projects-issues
Copy link
Collaborator Author

Stijn Maller commented

I just uploaded the file spring-batch-execution-src-folder In which 2 things were changed:

  1. Tests were added to execute the BatchCommandLineLauncher in a new JVM
  2. The JvmExitCodeMapper now maps a more generic code for Configuration errors. (In adding this I moved a few constants around to more logical places)

@spring-projects-issues
Copy link
Collaborator Author

Lucas Ward commented

BatchCommandLineLauncher now has unit tests and since it is correctly returning exit codes, I'm closing this issue and marking as fixed. I looked at the approach of kicking off an additional JVM, but I have some concerns about kicking off a new JVM within a unit test. If the current unit testing strategy is felt to be insufficient, a new issue can be opened for M3.

@spring-projects-issues
Copy link
Collaborator Author

Dave Syer commented

I changed the unit test to use the SystemExiter strategy, so we don't need a separate JVM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant