1Z0-900 · Question #37
Given a JSL document describing a batch job: How do you initiate a batch job?
The correct answer is A. Get the JobExecution object from BatchRuntime and call its start() method. There appears to be an error in the answer key provided - the marked correct answer (A) is actually incorrect based on the Java Batch API (JSR-352). The actual correct answer is C. In JSR-352, you initiate a batch job by calling BatchRuntime.getJobOperator() to retrieve a…
Question
Given a JSL document describing a batch job:
How do you initiate a batch job?
Exhibit
Options
- AGet the JobExecution object from BatchRuntime and call its start() method.
- BGet the JobExecution object from BatchRuntime and set its status to JobStatus.INITIATED.
- CGet the JobOperator object from BatchRuntime and call its start() method.
- DCall BatchRunTime.initialize("ProductLoadJob");
How the community answered
(23 responses)- A87% (20)
- C4% (1)
- D9% (2)
Explanation
There appears to be an error in the answer key provided - the marked correct answer (A) is actually incorrect based on the Java Batch API (JSR-352).
The actual correct answer is C.
In JSR-352, you initiate a batch job by calling BatchRuntime.getJobOperator() to retrieve a JobOperator instance, then invoking jobOperator.start("jobName", properties) on it - which returns a long execution ID. JobOperator is the control interface for batch job operations; it does not come from a getJobExecution() call on BatchRuntime.
Why the distractors are wrong:
- A is wrong because
BatchRuntimedoes not return aJobExecutionobject, andJobExecutionhas nostart()method - it represents the state of an already-running or completed job. - B is wrong for the same reason as A, plus you never set a status to trigger execution; status is read-only runtime metadata.
- D is wrong because
BatchRuntimehas noinitialize()method - it only exposesgetJobOperator().
Memory tip: Think of BatchRuntime as a factory and JobOperator as the control panel. You always go BatchRuntime → JobOperator → start().
Heads up: You may want to verify your answer key source - this question's marked answer (A) conflicts with the JSR-352 specification. The correct answer per the spec is C.
Topics
Community Discussion
No community discussion yet for this question.
