History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: QUARTZ-438
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: James House
Reporter: Jasper Rosenberg
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Quartz Scheduler

JobDetail.addJobListener()/Trigger.addTriggerListener() should enforce unique listener names

Created: 08/May/06 01:25 PM   Updated: 24/Dec/07 01:30 AM
Component/s: Triggers, Jobs
Affects Version/s: 1.6, 1.5.2
Fix Version/s: 1.6


 Description  « Hide
Both a JobDetail's and a Trigger's listeners are list based, which means they allow the same listener to be added multiple times. If you are using a RAMJobStore, this will be allowed and the same listener will simply be invoked multiple times. However, if you are using a JDBC JobStore, then you will get a unique constraint violation when Quartz tries to store the same listener name multiple times for the same Trigger/JobDetail in the database.

To make this behavior consistent, I suggest enforcing the listener name uniqueness when a new listener is added, throwing an IllegalArgumentException if there is a duplication.

To do this efficiently, we should switch the listener lists to ordered sets. Unfortunately, LinkedHashSet wasn't introduced until Java 1.4, so to maintain 1.3 compatibility I suggest using the commons collection ordered set via org.apache.commons.collections.SetUtils.orderedSet(Set).

Note: JobDetail does implement java.io.Serializable which means this change will break backwards serializablity. If this is important we can keep the jobListeners as a List, and use its less efficient contains() method to enforce uniqueness. However, I don't under what circumstance JobDetail would be serialized so this is likely safe.

 All   Comments   Change History      Sort Order:
There are no comments yet on this issue.