make Database.addChangeListener idempotent

Adding a ChangeListener to a Database should be idempotent: no matter
how many times the same listener is added, it should only be called
once. This matches the behaviour of Java's Observable.

Without this fix, it's possible for the framework to add the same change
listener more than once, resulting in changes getting processed more
than once, which can have unexpected results.
Merge pull request #221 from mjq/db_listener

Make Database.addChangeListener idempotent