繁体   English   中英

Spring Boot + AWS Linux + Oracle 数据库

[英]Spring boot + AWS Linux + Oracle database

我已经在 AWS Linux 上使用 JPA 开发了 Spring Boot REST API,使用Oracle11g作为数据库,因为我们正在处理 Spring Boot,所以我们不必处理连接。

netstat -n | grep 1521   

当我触发此命令以检查所有连接是否已关闭时,我可以看到许多连接处于CLOSE_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.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