public HystrixPropertiesCommandDefault(HystrixCommandPropertiesSetter setter)
 {
     CircuitBreakerEnabled = HystrixPropertyFactory.AsProperty(setter.CircuitBreakerEnabled, DefaultCircuitBreakerEnabled);
     CircuitBreakerErrorThresholdPercentage = HystrixPropertyFactory.AsProperty(setter.CircuitBreakerErrorThresholdPercentage, DefaultCircuitBreakerErrorThresholdPercentage);
     CircuitBreakerForceClosed = HystrixPropertyFactory.AsProperty(setter.CircuitBreakerForceClosed, DefaultCircuitBreakerForceClosed);
     CircuitBreakerForceOpen = HystrixPropertyFactory.AsProperty(setter.CircuitBreakerForceOpen, DefaultCircuitBreakerForceOpen);
     CircuitBreakerRequestVolumeThreshold = HystrixPropertyFactory.AsProperty(setter.CircuitBreakerRequestVolumeThreshold, DefaultCircuitBreakerRequestVolumeThreshold);
     CircuitBreakerSleepWindow = HystrixPropertyFactory.AsProperty(setter.CircuitBreakerSleepWindow, DefaultCircuitBreakerSleepWindow);
     ExecutionIsolationSemaphoreMaxConcurrentRequests = HystrixPropertyFactory.AsProperty(setter.ExecutionIsolationSemaphoreMaxConcurrentRequests, DefaultExecutionIsolationSemaphoreMaxConcurrentRequests);
     ExecutionIsolationStrategy = HystrixPropertyFactory.AsProperty(setter.ExecutionIsolationStrategy, DefaultExecutionIsolationStrategy);
     ExecutionIsolationThreadInterruptOnTimeout = HystrixPropertyFactory.AsProperty(setter.ExecutionIsolationThreadInterruptOnTimeout, DefaultExecutionIsolationThreadInterruptOnTimeout);
     ExecutionIsolationThreadPoolKeyOverride = HystrixPropertyFactory.AsProperty<string>((string)null);
     ExecutionIsolationThreadTimeout = HystrixPropertyFactory.AsProperty(setter.ExecutionIsolationThreadTimeout, DefaultExecutionIsolationThreadTimeout);
     FallbackIsolationSemaphoreMaxConcurrentRequests = HystrixPropertyFactory.AsProperty(setter.FallbackIsolationSemaphoreMaxConcurrentRequests, DefaultFallbackIsolationSemaphoreMaxConcurrentRequests);
     FallbackEnabled = HystrixPropertyFactory.AsProperty(setter.FallbackEnabled, DefaultFallbackEnabled);
     MetricsHealthSnapshotInterval = HystrixPropertyFactory.AsProperty(setter.MetricsHealthSnapshotInterval, DefaultMetricsHealthSnapshotInterval);
     MetricsRollingPercentileBucketSize = HystrixPropertyFactory.AsProperty(setter.MetricsRollingPercentileBucketSize, DefaultMetricsRollingPercentileBucketSize);
     MetricsRollingPercentileEnabled = HystrixPropertyFactory.AsProperty(setter.MetricsRollingPercentileEnabled, DefaultMetricsRollingPercentileEnabled);
     MetricsRollingPercentileWindowInMilliseconds = HystrixPropertyFactory.AsProperty(setter.MetricsRollingPercentileWindowInMilliseconds, DefaultMetricsRollingPercentileWindowInMilliseconds);
     MetricsRollingPercentileWindowBuckets = HystrixPropertyFactory.AsProperty(setter.MetricsRollingPercentileWindowBuckets, DefaultMetricsRollingPercentileWindowBuckets);
     MetricsRollingStatisticalWindowInMilliseconds = HystrixPropertyFactory.AsProperty(setter.MetricsRollingStatisticalWindowInMilliseconds, DefaultMetricsRollingStatisticalWindowInMilliseconds);
     MetricsRollingStatisticalWindowBuckets = HystrixPropertyFactory.AsProperty(setter.MetricsRollingStatisticalWindowBuckets, DefaultMetricsRollingStatisticalWindowBuckets);
     RequestCacheEnabled = HystrixPropertyFactory.AsProperty(setter.RequestCacheEnabled, DefaultRequestCacheEnabled);
     RequestLogEnabled = HystrixPropertyFactory.AsProperty(setter.RequestLogEnabled, DefaultRequestLogEnabled);
 }
 public HystrixPropertiesCommandDefault(HystrixCommandPropertiesSetter setter)
 {
     CircuitBreakerEnabled = HystrixPropertyFactory.AsProperty(setter.CircuitBreakerEnabled, DefaultCircuitBreakerEnabled);
     CircuitBreakerErrorThresholdPercentage = HystrixPropertyFactory.AsProperty(setter.CircuitBreakerErrorThresholdPercentage, DefaultCircuitBreakerErrorThresholdPercentage);
     CircuitBreakerForceClosed                        = HystrixPropertyFactory.AsProperty(setter.CircuitBreakerForceClosed, DefaultCircuitBreakerForceClosed);
     CircuitBreakerForceOpen                          = HystrixPropertyFactory.AsProperty(setter.CircuitBreakerForceOpen, DefaultCircuitBreakerForceOpen);
     CircuitBreakerRequestVolumeThreshold             = HystrixPropertyFactory.AsProperty(setter.CircuitBreakerRequestVolumeThreshold, DefaultCircuitBreakerRequestVolumeThreshold);
     CircuitBreakerSleepWindow                        = HystrixPropertyFactory.AsProperty(setter.CircuitBreakerSleepWindow, DefaultCircuitBreakerSleepWindow);
     ExecutionIsolationSemaphoreMaxConcurrentRequests = HystrixPropertyFactory.AsProperty(setter.ExecutionIsolationSemaphoreMaxConcurrentRequests, DefaultExecutionIsolationSemaphoreMaxConcurrentRequests);
     ExecutionIsolationStrategy                       = HystrixPropertyFactory.AsProperty(setter.ExecutionIsolationStrategy, DefaultExecutionIsolationStrategy);
     ExecutionIsolationThreadInterruptOnTimeout       = HystrixPropertyFactory.AsProperty(setter.ExecutionIsolationThreadInterruptOnTimeout, DefaultExecutionIsolationThreadInterruptOnTimeout);
     ExecutionIsolationThreadPoolKeyOverride          = HystrixPropertyFactory.AsProperty <string>((string)null);
     ExecutionIsolationThreadTimeout                  = HystrixPropertyFactory.AsProperty(setter.ExecutionIsolationThreadTimeout, DefaultExecutionIsolationThreadTimeout);
     FallbackIsolationSemaphoreMaxConcurrentRequests  = HystrixPropertyFactory.AsProperty(setter.FallbackIsolationSemaphoreMaxConcurrentRequests, DefaultFallbackIsolationSemaphoreMaxConcurrentRequests);
     FallbackEnabled = HystrixPropertyFactory.AsProperty(setter.FallbackEnabled, DefaultFallbackEnabled);
     MetricsHealthSnapshotInterval                 = HystrixPropertyFactory.AsProperty(setter.MetricsHealthSnapshotInterval, DefaultMetricsHealthSnapshotInterval);
     MetricsRollingPercentileBucketSize            = HystrixPropertyFactory.AsProperty(setter.MetricsRollingPercentileBucketSize, DefaultMetricsRollingPercentileBucketSize);
     MetricsRollingPercentileEnabled               = HystrixPropertyFactory.AsProperty(setter.MetricsRollingPercentileEnabled, DefaultMetricsRollingPercentileEnabled);
     MetricsRollingPercentileWindowInMilliseconds  = HystrixPropertyFactory.AsProperty(setter.MetricsRollingPercentileWindowInMilliseconds, DefaultMetricsRollingPercentileWindowInMilliseconds);
     MetricsRollingPercentileWindowBuckets         = HystrixPropertyFactory.AsProperty(setter.MetricsRollingPercentileWindowBuckets, DefaultMetricsRollingPercentileWindowBuckets);
     MetricsRollingStatisticalWindowInMilliseconds = HystrixPropertyFactory.AsProperty(setter.MetricsRollingStatisticalWindowInMilliseconds, DefaultMetricsRollingStatisticalWindowInMilliseconds);
     MetricsRollingStatisticalWindowBuckets        = HystrixPropertyFactory.AsProperty(setter.MetricsRollingStatisticalWindowBuckets, DefaultMetricsRollingStatisticalWindowBuckets);
     RequestCacheEnabled = HystrixPropertyFactory.AsProperty(setter.RequestCacheEnabled, DefaultRequestCacheEnabled);
     RequestLogEnabled   = HystrixPropertyFactory.AsProperty(setter.RequestLogEnabled, DefaultRequestLogEnabled);
 }
Пример #3
0
        public void PropertyFactory_Nested2()
        {
            IHystrixProperty <string> nullValue = HystrixPropertyFactory.NullProperty <string>();

            IHystrixProperty <string> withDefault = HystrixPropertyFactory.AsProperty(nullValue, "b");

            Assert.AreEqual("b", withDefault.Get());
        }
Пример #4
0
        public void PropertyFactory_Series2()
        {
            IHystrixProperty <string> nullValue = HystrixPropertyFactory.NullProperty <string>();
            IHystrixProperty <string> a         = HystrixPropertyFactory.AsProperty(nullValue, (string)null);

            IHystrixProperty <string> withDefault = HystrixPropertyFactory.AsProperty(a, nullValue, HystrixPropertyFactory.AsProperty("b"), nullValue, HystrixPropertyFactory.AsProperty("c"));

            Assert.AreEqual("b", withDefault.Get());
        }
Пример #5
0
        public void PropertyFactory_Nested1()
        {
            IHystrixProperty <string> a = HystrixPropertyFactory.AsProperty("a");

            Assert.AreEqual("a", a.Get());

            IHystrixProperty <string> aWithDefault = HystrixPropertyFactory.AsProperty(a, "b");

            Assert.AreEqual("a", aWithDefault.Get());
        }
Пример #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HystrixRollingNumber"/> class.
        /// </summary>
        /// <param name="time">The <see cref="ITime"/> instance to measure time.</param>
        /// <param name="timeInMilliseconds">The total time window to track.</param>
        /// <param name="numberOfBuckets">The number of parts to break the time window.</param>
        private HystrixRollingNumber(ITime time, IHystrixProperty <int> timeInMilliseconds, IHystrixProperty <int> numberOfBuckets)
        {
            this.time = time;
            this.timeInMilliseconds = timeInMilliseconds;
            this.numberOfBuckets    = numberOfBuckets;

            if (timeInMilliseconds.Get() % numberOfBuckets.Get() != 0)
            {
                throw new ArgumentException("The timeInMilliseconds must divide equally into numberOfBuckets. For example 1000/10 is ok, 1000/11 is not.");
            }

            this.buckets = new BucketCircularArray <Bucket>(numberOfBuckets.Get());
        }
Пример #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HystrixRollingPercentile"/> class.
        /// </summary>
        /// <param name="time">The <see cref="ITime"/> instance to measure time.</param>
        /// <param name="timeInMilliseconds">Number of milliseconds of data that should be tracked.</param>
        /// <param name="numberOfBuckets">Number of buckets that the time window should be divided into.</param>
        /// <param name="bucketDataLength">Number of values stored in each bucket.</param>
        /// <param name="enabled">Sets whether data should be tracked and percentiles be calculated.</param>
        internal HystrixRollingPercentile(ITime time, IHystrixProperty <int> timeInMilliseconds, IHystrixProperty <int> numberOfBuckets, IHystrixProperty <int> bucketDataLength, IHystrixProperty <bool> enabled)
        {
            if (timeInMilliseconds.Get() % numberOfBuckets.Get() != 0)
            {
                throw new ArgumentException("The timeInMilliseconds must divide equally into numberOfBuckets. For example 1000/10 is ok, 1000/11 is not.");
            }

            this.time = time;
            this.timeInMilliseconds = timeInMilliseconds;
            this.numberOfBuckets    = numberOfBuckets;
            this.bucketDataLength   = bucketDataLength;
            this.enabled            = enabled;
            this.buckets            = new BucketCircularArray <Bucket>(this.numberOfBuckets.Get());
        }
 public HystrixPropertiesCommandDefault(HystrixCommandPropertiesSetter setter)
 {
     CircuitBreakerEnabled = HystrixPropertyFactory.AsProperty(setter.CircuitBreakerEnabled, DefaultCircuitBreakerEnabled);
     CircuitBreakerErrorThresholdPercentage = HystrixPropertyFactory.AsProperty(setter.CircuitBreakerErrorThresholdPercentage, DefaultCircuitBreakerErrorThresholdPercentage);
     // dynamic property can be updated at runtime
     CircuitBreakerForceClosed = HystrixPropertyFactory.AsDynamicProperty(setter.CircuitBreakerForceClosed, DefaultCircuitBreakerForceClosed);
     // dynamic property can be updated at runtime
     CircuitBreakerForceOpen = HystrixPropertyFactory.AsDynamicProperty(setter.CircuitBreakerForceOpen, DefaultCircuitBreakerForceOpen);
     CircuitBreakerRequestVolumeThreshold = HystrixPropertyFactory.AsProperty(setter.CircuitBreakerRequestVolumeThreshold, DefaultCircuitBreakerRequestVolumeThreshold);
     CircuitBreakerSleepWindow            = HystrixPropertyFactory.AsProperty(setter.CircuitBreakerSleepWindow, DefaultCircuitBreakerSleepWindow);
     // dynamic property can be updated at runtime
     ExecutionIsolationThreadTimeout = HystrixPropertyFactory.AsDynamicProperty(setter.ExecutionIsolationThreadTimeout);
     MetricsHealthSnapshotInterval   = HystrixPropertyFactory.AsProperty(setter.MetricsHealthSnapshotInterval, DefaultMetricsHealthSnapshotInterval);
     MetricsRollingStatisticalWindowInMilliseconds = HystrixPropertyFactory.AsProperty(setter.MetricsRollingStatisticalWindowInMilliseconds, DefaultMetricsRollingStatisticalWindowInMilliseconds);
     MetricsRollingStatisticalWindowBuckets        = HystrixPropertyFactory.AsProperty(setter.MetricsRollingStatisticalWindowBuckets, DefaultMetricsRollingStatisticalWindowBuckets);
     MetricsIntegerBufferTimeWindowInSeconds       = HystrixPropertyFactory.AsProperty(setter.MetricsIntegerBufferTimeWindowInSeconds, DefaultMetricsIntegerBufferTimeWindowInSeconds);
     MetricsIntegerBufferBucketTimeWindowInSeconds = HystrixPropertyFactory.AsProperty(setter.MetricsIntegerBufferBucketTimeWindowInSeconds, DefaultMetricsIntegerBufferBucketTimeWindowInSeconds);
     MetricsIntegerBufferBucketSizeLimit           = HystrixPropertyFactory.AsProperty(setter.MetricsIntegerBufferBucketSizeLimit, DefaultMetricsIntegerBufferBucketSizeLimit);
     RequestLogEnabled = HystrixPropertyFactory.AsProperty(setter.RequestLogEnabled, DefaultRequestLogEnabled);
 }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HystrixRollingNumber"/> class.
 /// </summary>
 /// <param name="timeInMilliseconds">The total time window to track.</param>
 /// <param name="numberOfBuckets">The number of parts to break the time window.</param>
 public HystrixRollingNumber(IHystrixProperty <int> timeInMilliseconds, IHystrixProperty <int> numberOfBuckets)
     : this(ActualTime.Instance, timeInMilliseconds, numberOfBuckets)
 {
 }
 public virtual ThreadPoolExecutor GetThreadPool(HystrixThreadPoolKey threadPoolKey, IHystrixProperty <int> corePoolSize, IHystrixProperty <int> maximumPoolSize, IHystrixProperty <TimeSpan> keepAliveTime, IBlockingQueue <IRunnable> workQueue)
 {
     return(new ThreadPoolExecutor(corePoolSize.Get(), maximumPoolSize.Get(), keepAliveTime.Get(), workQueue, new DefaultThreadFactory(threadPoolKey)));
 }
Пример #11
0
 public HystrixPropertiesCollapserDefault(HystrixCollapserPropertiesSetter setter)
 {
     RequestCachingEnabled = HystrixPropertyFactory.AsProperty(setter.RequestCacheEnabled, DefaultRequestCacheEnabled);
     MaxRequestsInBatch    = HystrixPropertyFactory.AsProperty(setter.MaxRequestsInBatch, DefaultMaxRequestsInBatch);
     TimerDelay            = HystrixPropertyFactory.AsProperty(setter.TimerDelay, DefaultTimerDelay);
 }
Пример #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HystrixRollingNumber"/> class.
 /// </summary>
 /// <param name="timeInMilliseconds">The total time window to track.</param>
 /// <param name="numberOfBuckets">The number of parts to break the time window.</param>
 public HystrixRollingNumber(IHystrixProperty<int> timeInMilliseconds, IHystrixProperty<int> numberOfBuckets)
     : this(ActualTime.Instance, timeInMilliseconds, numberOfBuckets)
 {
 }
 public HystrixPropertyWrapperProperty(IHystrixProperty <T> value, T defaultValue)
 {
     this.value        = value;
     this.defaultValue = defaultValue;
 }
 public static IHystrixProperty <T> AsProperty <T>(IHystrixProperty <T> value, T defaultValue) where T : class
 {
     return(new HystrixPropertyWrapperProperty <T>(value, defaultValue));
 }
Пример #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HystrixRollingNumber"/> class.
        /// </summary>
        /// <param name="time">The <see cref="ITime"/> instance to measure time.</param>
        /// <param name="timeInMilliseconds">The total time window to track.</param>
        /// <param name="numberOfBuckets">The number of parts to break the time window.</param>
        private HystrixRollingNumber(ITime time, IHystrixProperty<int> timeInMilliseconds, IHystrixProperty<int> numberOfBuckets)
        {
            this.time = time;
            this.timeInMilliseconds = timeInMilliseconds;
            this.numberOfBuckets = numberOfBuckets;

            if (timeInMilliseconds.Get() % numberOfBuckets.Get() != 0)
            {
                throw new ArgumentException("The timeInMilliseconds must divide equally into numberOfBuckets. For example 1000/10 is ok, 1000/11 is not.");
            }

            this.buckets = new BucketCircularArray<Bucket>(numberOfBuckets.Get());
        }
Пример #16
0
 public TryableSemaphore(IHystrixProperty <int> numberOfPermits)
 {
     this.numberOfPermits = numberOfPermits;
 }
Пример #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HystrixRollingPercentile"/> class.
        /// </summary>
        /// <param name="time">The <see cref="ITime"/> instance to measure time.</param>
        /// <param name="timeInMilliseconds">Number of milliseconds of data that should be tracked.</param>
        /// <param name="numberOfBuckets">Number of buckets that the time window should be divided into.</param>
        /// <param name="bucketDataLength">Number of values stored in each bucket.</param>
        /// <param name="enabled">Sets whether data should be tracked and percentiles be calculated.</param>
        internal HystrixRollingPercentile(ITime time, IHystrixProperty<int> timeInMilliseconds, IHystrixProperty<int> numberOfBuckets, IHystrixProperty<int> bucketDataLength, IHystrixProperty<bool> enabled)
        {
            if (timeInMilliseconds.Get() % numberOfBuckets.Get() != 0)
            {
                throw new ArgumentException("The timeInMilliseconds must divide equally into numberOfBuckets. For example 1000/10 is ok, 1000/11 is not.");
            }

            this.time = time;
            this.timeInMilliseconds = timeInMilliseconds;
            this.numberOfBuckets = numberOfBuckets;
            this.bucketDataLength = bucketDataLength;
            this.enabled = enabled;
            this.buckets = new BucketCircularArray<Bucket>(this.numberOfBuckets.Get());
        }
Пример #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HystrixRollingPercentile"/> class.
 /// </summary>
 /// <param name="timeInMilliseconds">Number of milliseconds of data that should be tracked.</param>
 /// <param name="numberOfBuckets">Number of buckets that the time window should be divided into.</param>
 /// <param name="bucketDataLength">Number of values stored in each bucket.</param>
 /// <param name="enabled">Sets whether data should be tracked and percentiles be calculated.</param>
 public HystrixRollingPercentile(IHystrixProperty <int> timeInMilliseconds, IHystrixProperty <int> numberOfBuckets, IHystrixProperty <int> bucketDataLength, IHystrixProperty <bool> enabled)
     : this(ActualTime.Instance, timeInMilliseconds, numberOfBuckets, bucketDataLength, enabled)
 {
 }
Пример #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HystrixRollingPercentile"/> class.
 /// </summary>
 /// <param name="timeInMilliseconds">Number of milliseconds of data that should be tracked.</param>
 /// <param name="numberOfBuckets">Number of buckets that the time window should be divided into.</param>
 /// <param name="bucketDataLength">Number of values stored in each bucket.</param>
 /// <param name="enabled">Sets whether data should be tracked and percentiles be calculated.</param>
 public HystrixRollingPercentile(IHystrixProperty<int> timeInMilliseconds, IHystrixProperty<int> numberOfBuckets, IHystrixProperty<int> bucketDataLength, IHystrixProperty<bool> enabled)
     : this(ActualTime.Instance, timeInMilliseconds, numberOfBuckets, bucketDataLength, enabled)
 {
 }
Пример #20
0
 public TryableSemaphore(IHystrixProperty<int> numberOfPermits)
 {
     this.numberOfPermits = numberOfPermits;
 }
 public HystrixPropertiesCollapserDefault(HystrixCollapserPropertiesSetter setter)
 {
     RequestCachingEnabled = HystrixPropertyFactory.AsProperty(setter.RequestCacheEnabled, DefaultRequestCacheEnabled);
     MaxRequestsInBatch = HystrixPropertyFactory.AsProperty(setter.MaxRequestsInBatch, DefaultMaxRequestsInBatch);
     TimerDelay = HystrixPropertyFactory.AsProperty(setter.TimerDelay, DefaultTimerDelay);
 }