Package com.couchbase.client.core.endpoint

Examples of com.couchbase.client.core.endpoint.Endpoint


    }

    @Override
    public void send(final CouchbaseRequest request) {
        if (request instanceof BucketStreamingRequest) {
            final Endpoint endpoint = factory.create(hostname, bucket, password, port, env, responseBuffer);
            endpointStates.add(endpoint.states());
            endpoint
                .connect()
                .subscribe(new Subscriber<LifecycleState>() {
                    @Override
                    public void onCompleted() {
                        pinnedEndpoints.add(endpoint);
                        endpoint.send(request);
                        endpoint.send(SignalFlush.INSTANCE);
                    }

                    @Override
                    public void onError(Throwable e) {
                        request.observable().onError(e);
View Full Code Here


        this.strategy = strategy;
        this.responseBuffer = responseBuffer;
        endpointStates = new ArrayList<Observable<LifecycleState>>();
        endpoints = new Endpoint[numEndpoints];
        for (int i = 0; i < numEndpoints; i++) {
            Endpoint endpoint = factory.create(hostname, bucket, password, port, env, responseBuffer);
            endpoints[i] = endpoint;
            endpointStates.add(endpoint.states());
        }

        Observable.combineLatest(endpointStates, new FuncN<LifecycleState>() {
            @Override
            public LifecycleState call(Object... args) {
View Full Code Here

                endpoints[i].send(request);
            }
            return;
        }

        Endpoint endpoint = strategy.select(request, endpoints);
        if (endpoint == null) {
            responseBuffer.publishEvent(ResponseHandler.RESPONSE_TRANSLATOR, request, request.observable());
        } else {
            endpoint.send(request);
        }
    }
View Full Code Here

            } else {
                BinaryRequest binaryRequest = (BinaryRequest) request;
                short partition = binaryRequest.partition();
                if (partition > 0) {
                    int id = partition % numEndpoints;
                    Endpoint endpoint = endpoints[id];
                    if (endpoint != null && endpoint.isState(LifecycleState.CONNECTED)) {
                        return endpoint;
                    }
                } else {
                    return selectFirstConnected(endpoints);
                }
View Full Code Here

            return null;
        }

        for (int i = 0; i < MAX_TRIES; i++) {
            int rand = RANDOM.nextInt(endpoints.length);
            Endpoint endpoint = endpoints[rand];
            if (endpoint.isState(LifecycleState.CONNECTED)) {
                return endpoint;
            }
        }

        return null;
View Full Code Here

TOP

Related Classes of com.couchbase.client.core.endpoint.Endpoint

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.