【Hystrix】【06】maxQueueSize Rejected command because thread-pool queueSize is at rejection threshold.

https://github.com/Netflix/Hystrix/wiki/Configuration#ThreadPool

1.异常

java.util.concurrent.RejectedExecutionException: Rejected command because thread-pool queueSize is at rejection threshold.
 at com.netflix.hystrix.strategy.concurrency.HystrixContextScheduler$HystrixContextSchedulerWorker.schedule(HystrixContextScheduler.java:103)
 at rx.internal.operators.OperatorSubscribeOn.call(OperatorSubscribeOn.java:45)
 at rx.internal.operators.OperatorSubscribeOn.call(OperatorSubscribeOn.java:30)
 at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50)
 at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
 at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50)
 at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
 at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50)

2.使用maxQueueSize需要配合queueSizeRejectionThreshold一起使用

maxQueueSize
This property sets the maximum queue size of the BlockingQueue implementation.

If you set this to -1 then SynchronousQueue will be used, otherwise a positive value will be used with LinkedBlockingQueue.

Note: This property only applies at initialization time since queue implementations cannot be resized or changed without re-initializing the thread executor which is not supported.

If you need to overcome this limitation and to allow dynamic changes in the queue, see the queueSizeRejectionThreshold property.

To change between SynchronousQueue and LinkedBlockingQueue requires a restart.

Default Value −1
Default Property hystrix.threadpool.default.maxQueueSize
Instance Property hystrix.threadpool.HystrixThreadPoolKey.maxQueueSize
How to Set Instance Default
HystrixThreadPoolProperties.Setter()
.withMaxQueueSize(int value)
queueSizeRejectionThreshold
This property sets the queue size rejection threshold — an artificial maximum queue size at which rejections will occur even if maxQueueSize has not been reached. This property exists because the maxQueueSize of a BlockingQueue cannot be dynamically changed and we want to allow you to dynamically change the queue size that affects rejections.

This is used by HystrixCommand when queuing a thread for execution.

Note: This property is not applicable if maxQueueSize == -1.

Default Value 5
Default Property hystrix.threadpool.default.queueSizeRejectionThreshold
Instance Property hystrix.threadpool.HystrixThreadPoolKey.queueSizeRejectionThreshold
How to Set Instance Default
HystrixThreadPoolProperties.Setter()
.withQueueSizeRejectionThreshold(int value)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值