简体   繁体   English

Spring Boot + AWS Linux + Oracle 数据库

[英]Spring boot + AWS Linux + Oracle database

I have developed Spring Boot REST API with JPA on AWS Linux with Oracle11g as database, as we are dealing with Spring boot we don't have to take care of connections.我已经在 AWS Linux 上使用 JPA 开发了 Spring Boot REST API,使用Oracle11g作为数据库,因为我们正在处理 Spring Boot,所以我们不必处理连接。

netstat -n | grep 1521   

When I fired this command to check whether all connections are closed or not, I can see many connections are in CLOSE_WAIT state.当我触发此命令以检查所有连接是否已关闭时,我可以看到许多连接处于CLOSE_WAIT状态。
Can anyone suggest whether what is wrong in application or configuration of Tomcat or Apache?任何人都可以建议Tomcat或Apache的应用程序或配置是否有问题?

application.properties应用程序属性

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

The issue's been the fact the HttpResponse hasn't been closed, to fix this I've used HttpClientUtils.closeQuietly, see below :问题是 HttpResponse 尚未关闭,为了解决这个问题,我使用了 HttpClientUtils.closeQuietly,见下文:

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);
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM