簡體   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