public void process()

in curator-x-async/src/main/java/org/apache/curator/x/async/details/InternalWatcher.java [47:83]


    public void process(WatchedEvent event) {
        final WatchedEvent localEvent = (watcherFilter != null) ? watcherFilter.apply(event) : event;
        switch (localEvent.getState()) {
            default: {
                if ((watchMode != WatchMode.stateChangeOnly) && (localEvent.getType() != Event.EventType.None)) {
                    if (!future.complete(localEvent)) {
                        future.obtrudeValue(localEvent);
                    }
                }
                break;
            }

            case Disconnected:
            case AuthFailed:
            case Expired: {
                if (watchMode != WatchMode.successOnly) {
                    AsyncEventException exception = new AsyncEventException() {
                        private final AtomicBoolean isReset = new AtomicBoolean(false);

                        @Override
                        public Event.KeeperState getKeeperState() {
                            return localEvent.getState();
                        }

                        @Override
                        public CompletionStage<WatchedEvent> reset() {
                            Preconditions.checkState(isReset.compareAndSet(false, true), "Already reset");
                            future = new CompletableFuture<>();
                            return future;
                        }
                    };
                    future.completeExceptionally(exception);
                }
                break;
            }
        }
    }