
| Key: |
BATCH-292
|
| Type: |
Bug
|
| Status: |
Closed
|
| Resolution: |
Duplicate
|
| Priority: |
Critical
|
| Assignee: |
Unassigned
|
| Reporter: |
Gregory Kick
|
| Votes: |
0
|
| Watchers: |
0
|
|
If you were logged in you would be able to see more operations.
|
|
|
|
Job Identifier is documented as being a strategy (and as such, is an interface). However, the interface really seems to define a value object that is used as a unique key. Thus, the primary use for a JobInstance is .equals() and .hashCode().
E.g.
if (registry.containsKey(jobIdentifier)) {
return ((JobExecutionHolder) registry.get(jobIdentifier)).getExecution();
}
This requires that .equals() and .hashCode() are consistently implemented across all implementations of JobInterface. I don't have my copy of "Effective Java" around, but it's pretty clear in how unlikely that is (especially with no documentation about the fact that it will be used that way).
A more appropriate alternative would be to convert JobIdentifier to a value object and provide factories for conveniently populating different properties (e.g. JobIdentifier newScheduledJobIdentifier(String jobName, Date scheduleDate)).
|
|
Description
|
Job Identifier is documented as being a strategy (and as such, is an interface). However, the interface really seems to define a value object that is used as a unique key. Thus, the primary use for a JobInstance is .equals() and .hashCode().
E.g.
if (registry.containsKey(jobIdentifier)) {
return ((JobExecutionHolder) registry.get(jobIdentifier)).getExecution();
}
This requires that .equals() and .hashCode() are consistently implemented across all implementations of JobInterface. I don't have my copy of "Effective Java" around, but it's pretty clear in how unlikely that is (especially with no documentation about the fact that it will be used that way).
A more appropriate alternative would be to convert JobIdentifier to a value object and provide factories for conveniently populating different properties (e.g. JobIdentifier newScheduledJobIdentifier(String jobName, Date scheduleDate)). |
Show » |
|
BATCH-288, so it is being closed. The description has been added as a comment to 288.