spotify / dns-java

DNS wrapper library that provides SRV lookup functionality
Apache License 2.0
206 stars 47 forks source link

Notifier race condition #17

Closed mikaelgoldmann closed 9 years ago

pettermahlen commented 9 years ago

Nice catch! I don't fully understand from the test how the race manifests itself, but I guess it turns into a missed listener update?

mikaelgoldmann commented 9 years ago

@pettermahlen Yes, the fireRecordsUpdated can be call from different threads: a polling thread and a thread calling setListener(listener, true). If there is an update right then, the old result can reach the listener after the new result, and the state will remain until there is another update from the polling thread.

pettermahlen commented 9 years ago

:+1: thanks!