// notifies all watchers about a exception. it doesn't close watchers. // it is the responsibility of user to close watchers. private void notifyWatchers(EtcdException e) { WatchResponseWithError wre = new WatchResponseWithError(e); if (!this.pendingWatchers.IsEmpty) { while (!this.pendingWatchers.IsEmpty) { // this.pendingWatchers.try } } //this.pendingWatchers.forEach(watcher -> { // try { // watcher.enqueue(wre); // } catch (Exception we) { // LOG.warn("failed to notify watcher", we); // } //}); //this.pendingWatchers.clear(); //this.watchers.values().forEach(watcher -> { // try { // watcher.enqueue(wre); // } catch (Exception we) { // LOG.warn("failed to notify watcher", we); // } //}); this.watchers.Clear(); }
private void enqueue(WatchResponseWithError watchResponse) { try { this.eventsQueue.Enqueue(watchResponse); } catch (Exception e) { Thread.CurrentThread.Interrupt(); //LOG.warn("Interrupted", e); } }
private WatchResponse CreateWatchResponseFuture() { WatchResponseWithError watchResponse = null; this.eventsQueue.TryDequeue(out watchResponse); if (watchResponse != null) { return(new WatchResponse(watchResponse.GetWatchResponse())); } else { return(null); } }
internal void Enqueue(WatchResponseWithError watchResponseWithError) { throw new NotImplementedException(); }