Package org.elasticsearch.common.breaker

Examples of org.elasticsearch.common.breaker.CircuitBreaker


            logger.trace("parent circuit breaker with settings {}", this.parentSettings);
        }

        Map<CircuitBreaker.Name, CircuitBreaker> tempBreakers = new HashMap<>();

        CircuitBreaker fielddataBreaker;
        if (fielddataSettings.getType() == CircuitBreaker.Type.NOOP) {
            fielddataBreaker = new NoopCircuitBreaker(CircuitBreaker.Name.FIELDDATA);
        } else {
            fielddataBreaker = new ChildMemoryCircuitBreaker(fielddataSettings, logger, this, CircuitBreaker.Name.FIELDDATA);
        }

        CircuitBreaker requestBreaker;
        if (requestSettings.getType() == CircuitBreaker.Type.NOOP) {
            requestBreaker = new NoopCircuitBreaker(CircuitBreaker.Name.REQUEST);
        } else {
            requestBreaker = new ChildMemoryCircuitBreaker(requestSettings, logger, this, CircuitBreaker.Name.REQUEST);
        }
View Full Code Here


        return new AllCircuitBreakerStats(allStats.toArray(new CircuitBreakerStats[allStats.size()]));
    }

    @Override
    public CircuitBreakerStats stats(CircuitBreaker.Name name) {
        CircuitBreaker breaker = this.breakers.get(name);
        return new CircuitBreakerStats(breaker.getName(), breaker.getLimit(), breaker.getUsed(), breaker.getOverhead(), breaker.getTrippedCount());
    }
View Full Code Here

                HierarchyCircuitBreakerService.this.parentSettings = newParentSettings;
                HierarchyCircuitBreakerService.this.fielddataSettings = newFielddataSettings;
                HierarchyCircuitBreakerService.this.requestSettings = newRequestSettings;

                Map<CircuitBreaker.Name, CircuitBreaker> tempBreakers = new HashMap<>();
                CircuitBreaker fielddataBreaker;
                if (newFielddataSettings.getType() == CircuitBreaker.Type.NOOP) {
                    fielddataBreaker = new NoopCircuitBreaker(CircuitBreaker.Name.FIELDDATA);
                } else {
                    fielddataBreaker = new ChildMemoryCircuitBreaker(newFielddataSettings,
                            (ChildMemoryCircuitBreaker) HierarchyCircuitBreakerService.this.breakers.get(CircuitBreaker.Name.FIELDDATA),
                            logger, HierarchyCircuitBreakerService.this, CircuitBreaker.Name.FIELDDATA);
                }

                CircuitBreaker requestBreaker;
                if (newRequestSettings.getType() == CircuitBreaker.Type.NOOP) {
                    requestBreaker = new NoopCircuitBreaker(CircuitBreaker.Name.REQUEST);
                } else {
                    requestBreaker = new ChildMemoryCircuitBreaker(newRequestSettings,
                            (ChildMemoryCircuitBreaker)HierarchyCircuitBreakerService.this.breakers.get(CircuitBreaker.Name.REQUEST),
View Full Code Here

     * negative, or checkBreaker is false, the breaker will be adjusted
     * without tripping
     */
    void adjustBreaker(long delta) {
        if (this.breakerService != null) {
            CircuitBreaker breaker = this.breakerService.getBreaker(CircuitBreaker.Name.REQUEST);
            if (this.checkBreaker == true) {
                // checking breaker means potentially tripping, but it doesn't
                // have to if the delta is negative
                if (delta > 0) {
                    try {
                        breaker.addEstimateBytesAndMaybeBreak(delta, "<reused_arrays>");
                    } catch (CircuitBreakingException e) {
                        // since we've already created the data, we need to
                        // add it so closing the stream re-adjusts properly
                        breaker.addWithoutBreaking(delta);
                        // re-throw the original exception
                        throw e;
                    }
                } else {
                    breaker.addWithoutBreaking(delta);
                }
            } else {
                // even if we are not checking the breaker, we need to adjust
                // its' totals, so add without breaking
                breaker.addWithoutBreaking(delta);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.breaker.CircuitBreaker

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.