Exemple #1
0
            public void ChangeTrackerStopped(ChangeTracker tracker, ErrorResolution resolution)
            {
                if (StoppedDelegate != null)
                {
                    StoppedDelegate(tracker, resolution);
                }

                if (stoppedSignal != null)
                {
                    stoppedSignal.Signal();
                }
            }
        protected override void Stopped(ErrorResolution resolution)
        {
            var client = Client;

            Client = null;
            if (client != null)
            {
                Log.To.ChangeTracker.V(Tag, "{0} posting stopped to client", this);
                client.ChangeTrackerStopped(this, resolution);
            }

            Log.To.ChangeTracker.D(Tag, "change tracker client should be null now");
        }
        private void ProcessChangeTrackerStopped(ChangeTracker tracker, ErrorResolution resolution)
        {
            var webSocketTracker = tracker as WebSocketChangeTracker;

            if (webSocketTracker != null && !webSocketTracker.CanConnect)
            {
                ReplicationOptions.UseWebSocket = false;
                _canBulkGet = false;
                Log.To.Sync.I(TAG, "Server doesn't support web socket changes feed, switching " +
                              "to regular HTTP");
                StartChangeTracker();
                return;
            }

            if (tracker.Error != null)
            {
                Log.To.Sync.I(TAG, "Change tracker for {0} stopped; error={1}", ReplicatorID, tracker.Error);
            }
            else
            {
                Log.To.Sync.I(TAG, "Change tracker for {0} stopped", ReplicatorID);
            }

            if (LastError == null && tracker.Error != null)
            {
                LastError = tracker.Error;
            }

            Batcher.FlushAll();
            if (resolution == ErrorResolution.RetryLater)
            {
                Log.To.Sync.I(TAG, "Change tracked stopped, entering retry loop...");
                ScheduleRetryIfReady();
            }
            else if (resolution == ErrorResolution.GoOffline)
            {
                GoOffline();
            }
            else if (resolution == ErrorResolution.Stop)
            {
                if (Continuous || (ChangesCount == CompletedChangesCount && IsSafeToStop))
                {
                    Log.To.Sync.V(TAG, "Change tracker stopped, firing StopGraceful...");
                    FireTrigger(ReplicationTrigger.StopGraceful);
                }
            }
        }
 protected abstract void Stopped(ErrorResolution resolution);
 public void ChangeTrackerStopped(ChangeTracker tracker, ErrorResolution resolution)
 {
     WorkExecutor.StartNew(() => ProcessChangeTrackerStopped(tracker, resolution));
 }
Exemple #6
0
 protected override void Stopped(ErrorResolution resolution)
 {
     Client?.ChangeTrackerStopped(this, resolution);
     Misc.SafeDispose(ref _responseLogic);
 }