public virtual void Changed(Replication.ChangeEvent @event) { Replication replicator = @event.GetSource(); Log.D(Tag, replicator + " changed. " + replicator.GetCompletedChangesCount() + " / " + replicator.GetChangesCount()); NUnit.Framework.Assert.IsTrue(replicator.GetCompletedChangesCount() <= replicator .GetChangesCount()); if (replicator.GetCompletedChangesCount() > replicator.GetChangesCount()) { throw new RuntimeException("replicator.getCompletedChangesCount() > replicator.getChangesCount()" ); } if (!replicator.IsRunning()) { replicationFinished = true; string msg = string.Format("ReplicationFinishedObserver.changed called, set replicationFinished to: %b" , replicationFinished); Log.D(Tag, msg); doneSignal.CountDown(); } else { string msg = string.Format("ReplicationFinishedObserver.changed called, but replicator still running, so ignore it" ); Log.D(Tag, msg); } }
public virtual void Changed(Replication.ChangeEvent @event) { Replication replicator = @event.GetSource(); if (replicator.IsRunning()) { doneSignal.CountDown(); } }
public virtual void Changed(Replication.ChangeEvent @event) { Replication replicator = @event.GetSource(); Log.D(Tag, replicator + " changed. " + replicator.GetCompletedChangesCount() + " / " + replicator.GetChangesCount()); if (replicator.GetCompletedChangesCount() < 0) { string msg = string.Format("%s: replicator.getCompletedChangesCount() < 0", replicator ); Log.D(Tag, msg); throw new RuntimeException(msg); } if (replicator.GetChangesCount() < 0) { string msg = string.Format("%s: replicator.getChangesCount() < 0", replicator); Log.D(Tag, msg); throw new RuntimeException(msg); } // see https://github.com/couchbase/couchbase-lite-java-core/issues/100 if (replicator.GetCompletedChangesCount() > replicator.GetChangesCount()) { string msg = string.Format("replicator.getCompletedChangesCount() - %d > replicator.getChangesCount() - %d" , replicator.GetCompletedChangesCount(), replicator.GetChangesCount()); Log.D(Tag, msg); throw new RuntimeException(msg); } if (!replicator.IsRunning()) { replicationFinished = true; string msg = string.Format("ReplicationFinishedObserver.changed called, set replicationFinished to: %b" , replicationFinished); Log.D(Tag, msg); doneSignal.CountDown(); } else { string msg = string.Format("ReplicationFinishedObserver.changed called, but replicator still running, so ignore it" ); Log.D(Tag, msg); } }