Package org.elasticsearch.common.util.concurrent

Examples of org.elasticsearch.common.util.concurrent.CountDown


        if (!event.localNodeMaster()) {
            return;
        }
        final String source = "reroute_rivers_node_changed";
        //we'll try again a few times if we don't find the river _meta document while the type is there
        final CountDown countDown = new CountDown(RIVER_START_MAX_RETRIES);
        riverClusterService.submitStateUpdateTask(source, new RiverClusterStateUpdateTask() {
            @Override
            public RiverClusterState execute(RiverClusterState currentState) {
                return updateRiverClusterState(source, currentState, event.state(), countDown);
            }
View Full Code Here


            }

            this.request = request;
            this.listener = listener;
            this.expHolder = new AtomicReference<>();
            this.expectedOps = new CountDown(expectedOps);
        }
View Full Code Here

        if (concreteIndices.length == 0) {
            listener.onResponse(new DeleteIndexResponse(true));
            return;
        }
        // TODO: this API should be improved, currently, if one delete index failed, we send a failure, we should send a response array that includes all the indices that were deleted
        final CountDown count = new CountDown(concreteIndices.length);
        for (final String index : concreteIndices) {
            deleteIndexService.deleteIndex(new MetaDataDeleteIndexService.Request(index).timeout(request.timeout()).masterTimeout(request.masterNodeTimeout()), new MetaDataDeleteIndexService.Listener() {

                private volatile Throwable lastFailure;
                private volatile boolean ack = true;

                @Override
                public void onResponse(MetaDataDeleteIndexService.Response response) {
                    if (!response.acknowledged()) {
                        ack = false;
                    }
                    if (count.countDown()) {
                        if (lastFailure != null) {
                            listener.onFailure(lastFailure);
                        } else {
                            listener.onResponse(new DeleteIndexResponse(ack));
                        }
                    }
                }

                @Override
                public void onFailure(Throwable t) {
                    logger.debug("[{}] failed to delete index", t, index);
                    lastFailure = t;
                    if (count.countDown()) {
                        listener.onFailure(t);
                    }
                }
            });
        }
View Full Code Here

        protected final CountDown countDown;
        protected final CopyOnWriteArrayList<T> responses = new CopyOnWriteArrayList<T>();
        protected final CopyOnWriteArrayList<Throwable> failures = new CopyOnWriteArrayList<Throwable>();

        protected CountDownAsyncHandler(int size) {
            countDown = new CountDown(size);
        }
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.util.concurrent.CountDown

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.