Java 弹簧靴&x2B;AWS Linux+;Oracle数据库
我已经在AWS Linux上用JPA开发了Spring Boot REST API,并使用Java 弹簧靴&x2B;AWS Linux+;Oracle数据库,java,linux,spring-boot,amazon-ec2,oracle11g,Java,Linux,Spring Boot,Amazon Ec2,Oracle11g,我已经在AWS Linux上用JPA开发了Spring Boot REST API,并使用Oracle11g作为数据库,因为我们处理的是Spring Boot,所以不需要处理连接 netstat -n | grep 1521 当我启动此命令检查所有连接是否关闭时,我可以看到许多连接处于CLOSE\u WAIT状态。 有人能建议Tomcat或Apache的应用程序或配置中是否存在错误吗 应用程序属性 spring.datasource.remove-abandoned=true spr
Oracle11g
作为数据库,因为我们处理的是Spring Boot,所以不需要处理连接
netstat -n | grep 1521
当我启动此命令检查所有连接是否关闭时,我可以看到许多连接处于CLOSE\u WAIT
状态。有人能建议Tomcat或Apache的应用程序或配置中是否存在错误吗 应用程序属性
spring.datasource.remove-abandoned=true
spring.datasource.remove-abandoned-timeout=30
spring.datasource.max-active=50
spring.datasource.max-idle=8
spring.datasource.min-idle=8
spring.datasource.initial-size=10
spring.datasource.max-wait=10000
问题在于HttpResponse尚未关闭,为了解决这个问题,我使用了HttpClientUtils.closequirey,请参见以下内容:
HttpResponse response = null;
try {
response = client.execute(createHttpRequest(url, timeOut));
StringBuilder result = new StringBuilder();
try (BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()))) {
String line;
while ((line = rd.readLine()) != null) {
result.append(line);
}
}
return result;
} catch (org.apache.http.conn.HttpHostConnectException e) {
throw new HostUnreachableException(e);
} finally {
HttpClientUtils.closeQuietly(response);
}
像这样的问题究竟是如何被否决的?Tomcat或Apache的应用程序或配置有什么问题这怎么可能呢?我们是读心术的人吗?如果您想检查一些代码或配置文件,那么至少您需要做的是postit@ScaryWombat我也不能共享apache或tomcat的配置文件。我只是想知道是否有人遇到过类似的问题,在后台打开这么多CLOSE_WAIT实例。你们认为我们可以在Spring Boot应用程序中编写这段代码吗??