couchbaselabs/TouchDB-Android — pull request #62 by pegli (2012-08-03 00:03:07+00:00)
Title: TDReplicator never calls notifyObservers()

I'm observing TDReplicator to determine when async replication is complete and to get an idea of replication progress, but the update() method of my Observer class is never called. The intent to use the Observable/Observer pattern is there -- TDReplicator.setChangesTotal() and setChangesProcessed() call notifyObservers(), but nothing calls them. Instead, TDPuller and TDPusher modify the changesTotal and changesProcessed member variables directly.

In this pull request, I have made changesTotal and changesProcessed private and have updated TDPuller and TDPusher to use the setter methods any time the number of changes, er, changes. As a result, my observer is being called as expected.