Java-确切含义http.maxConnections [英] Java - exact meaning http.maxConnections

查看:76
本文介绍了Java-确切含义http.maxConnections的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我遇到了Oracle提供的java属性 http.maxConnections 的2个稍微不同的定义.

Recently I came across 2 slightly different definitions of the java property http.maxConnections provided by Oracle.

此处定义为

如果启用了HTTP keepalive,则此值将确定每个目标同时保持活动状态的最大空闲连接数.

If HTTP keepalive is enabled this value determines the maximum number of idle connections that will be simultaneously kept alive, per destination.

此处定义为

指示每个目的地在任何给定时间保持活动状态的最大连接数

Indicates the maximum number of connections per destination to be kept alive at any given time

让我感到困惑的是上面第一个定义中提到的 idle 一词.考虑到第一个定义,我的理解是,此属性仅限制连接池中存在但未使用的连接数.这意味着无论采用哪种配置,我都可以同时向同一端点运行无限数量的活动连接.如果我考虑上面的第二个定义(Oracle删除了te关键字),我的理解也不尽相同.闲置的.在这最后一个函数中,似乎该属性旨在限制与端点的连接总数,因此,如果我配置http.maxConnections = 10,则最多可以有10个同时向同一端点的调用.

What confuses me is the word idle mentioned in the first definition above. Considering the first definition my understanding is that this property limits only the number of connections which are there in the connection pool but that are not used. This means that regardless of this config, I could have un "unlimited" number of active connections towards the same endpoint running at the same time.I don't have the same understanding if I consider the second definition above, where Oracle removed te keyword idle. In this last it seems this property is meant to limit the total number of connections towards an endpoint, so if I configure http.maxConnections=10 I can have at maximum 10 simultaneous calls towards the same endpoint.

有人可以消除我的疑虑吗?

Can someone clear my doubts ?

谢谢!

(ps:为了完整起见,我对Java8行为感兴趣)

(ps: for the sake of completeness i'm interested in Java8 behavior)

推荐答案

代码检查显示该属性仅用于限制keep-alive缓存的大小-因此,除非我错误地认为这实际上是最大的空闲数连接.

Code inspection shows that the property is only used to limit the size of the keep-alive cache - so unless I'm mistaken that's really the maximum number of idle connections.

这篇关于Java-确切含义http.maxConnections的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆