[jsword-devel] getJobs() has disappeared...

DM Smith dmsmith at crosswire.org
Sun Apr 7 11:45:54 MST 2013

On Apr 7, 2013, at 10:29 AM, Chris Burrell <chris at burrell.me.uk> wrote:

> Hello
> Just updated to the latest copy of JSword from master, and it looks like we've removed getJobs().
> I'm happy to use the iterator() but just wondering why it was removed?

The implementation of JobManager was redone in its entirety to eliminate the deadlocks that were occurring.

The method getJobs returned a copy of the collection of jobs held by JobManager. This method was synchronized and seemed to be at the root of the deadlock. The purpose of the method was to allow the application to work with the copy, most typically iterating over the collection that it returned.

By replacing getJobs() with iterator(), the synchronization problem was avoided and the overhead of the copy was avoided.

IIRC, BibleDesktop called getJobs for each time its listener was notified. For a desktop app, this is not noticeable, but with a server app it adds up and with a mobile app it is noticeable. (At least in theory ;)

Martin has a pull request with the introduction of getJobCount.

-- DM

More information about the jsword-devel mailing list