From cb8700b324e8837fb9896d84785b25b3d9944752 Mon Sep 17 00:00:00 2001 From: xxxllluuu Date: Fri, 21 Aug 2020 10:18:31 +0800 Subject: [PATCH] https://github.com/edp963/davinci/issues/1898 1. fix some issues --- config/application.yml.example | 36 +++-- .../edp/core/common/jdbc/JdbcDataSource.java | 131 +++++++++++------- .../java/edp/core/config/DruidConfig.java | 8 ++ .../main/java/edp/core/utils/DateUtils.java | 26 ++++ .../main/java/edp/core/utils/FileUtils.java | 10 ++ .../main/java/edp/core/utils/SourceUtils.java | 101 +++++++++----- .../main/java/edp/core/utils/SqlUtils.java | 37 ++--- .../davinci/dto/cronJobDto/MsgMailExcel.java | 2 +- .../davinci/service/excel/ExecutorUtil.java | 16 +-- .../davinci/service/excel/SheetWorker.java | 35 +++-- .../davinci/service/excel/WorkbookWorker.java | 51 +++++-- .../service/impl/SourceMessageHandler.java | 10 +- .../service/impl/SourceServiceImpl.java | 73 +++++----- .../service/screenshot/ScreenshotUtil.java | 37 +++-- server/src/main/resources/application.yml | 13 -- 15 files changed, 374 insertions(+), 212 deletions(-) diff --git a/config/application.yml.example b/config/application.yml.example index bfb1b5f05..92bb1882a 100644 --- a/config/application.yml.example +++ b/config/application.yml.example @@ -40,14 +40,22 @@ jwtToken: ##your datasouce config source: - initial-size: 2 + initial-size: 1 min-idle: 1 - max-wait: 6000 + max-wait: 30000 max-active: 10 break-after-acquire-failure: true - connection-error-retry-attempts: 0 - query-timeout: 600000 - validationQueryTimeout: 30000 + connection-error-retry-attempts: 1 + time-between-eviction-runs-millis: 2000 + min-evictable-idle-time-millis: 600000 + max-evictable-idle-time-millis: 900000 + test-while-idle: true + test-on-borrow: false + test-on-return: false + validation-query: select 1 + validation-query-timeout: 10 + keep-alive: false + filters: stat enable-query-log: false result-limit: 1000000 @@ -69,10 +77,22 @@ spring: username: root password: root driver-class-name: com.mysql.jdbc.Driver - initial-size: 2 + initial-size: 1 min-idle: 1 - max-wait: 60000 + max-wait: 30000 max-active: 10 + break-after-acquire-failure: true + connection-error-retry-attempts: 1 + time-between-eviction-runs-millis: 2000 + min-evictable-idle-time-millis: 600000 + max-evictable-idle-time-millis: 900000 + test-while-idle: true + test-on-borrow: false + test-on-return: false + validation-query: select 1 + validation-query-timeout: 10 + keep-alive: false + filters: stat ## redis config ## please choose either of the two ways @@ -156,7 +176,7 @@ screenshot: timeout_second: 600 phantomjs_path: $your_phantomjs_path$ chromedriver_path: $your_chromedriver_path$ - remote_webdriver_url:$your_remote_webdriver_url$ + remote_webdriver_url: $your_remote_webdriver_url$ data-auth-center: channels: diff --git a/server/src/main/java/edp/core/common/jdbc/JdbcDataSource.java b/server/src/main/java/edp/core/common/jdbc/JdbcDataSource.java index 7565bac2b..3b0da198b 100644 --- a/server/src/main/java/edp/core/common/jdbc/JdbcDataSource.java +++ b/server/src/main/java/edp/core/common/jdbc/JdbcDataSource.java @@ -19,25 +19,14 @@ package edp.core.common.jdbc; -import static com.alibaba.druid.pool.DruidDataSourceFactory.PROP_CONNECTIONPROPERTIES; -import static com.alibaba.druid.pool.DruidDataSourceFactory.PROP_INITIALSIZE; -import static com.alibaba.druid.pool.DruidDataSourceFactory.PROP_MAXACTIVE; -import static com.alibaba.druid.pool.DruidDataSourceFactory.PROP_MAXWAIT; -import static com.alibaba.druid.pool.DruidDataSourceFactory.PROP_MINEVICTABLEIDLETIMEMILLIS; -import static com.alibaba.druid.pool.DruidDataSourceFactory.PROP_MINIDLE; -import static com.alibaba.druid.pool.DruidDataSourceFactory.PROP_PASSWORD; -import static com.alibaba.druid.pool.DruidDataSourceFactory.PROP_TESTONBORROW; -import static com.alibaba.druid.pool.DruidDataSourceFactory.PROP_TESTONRETURN; -import static com.alibaba.druid.pool.DruidDataSourceFactory.PROP_TESTWHILEIDLE; -import static com.alibaba.druid.pool.DruidDataSourceFactory.PROP_TIMEBETWEENEVICTIONRUNSMILLIS; -import static com.alibaba.druid.pool.DruidDataSourceFactory.PROP_URL; -import static com.alibaba.druid.pool.DruidDataSourceFactory.PROP_USERNAME; +import static com.alibaba.druid.pool.DruidDataSourceFactory.*; import static edp.core.consts.Consts.JDBC_DATASOURCE_DEFAULT_VERSION; import java.io.File; import java.util.Map; import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -79,17 +68,27 @@ public DruidDataSource getDataSource(JdbcSourceInfo jdbcSourceInfo) throws Sourc if (druidDataSource != null && !druidDataSource.isClosed()) { return druidDataSource; } - + Lock lock = getDataSourceLock(key); - - try { - if (!lock.tryLock(5L, TimeUnit.SECONDS)) { - throw new SourceException("Unable to get driver instance for jdbcUrl: " + jdbcUrl); - } - } - catch (InterruptedException e) { - throw new SourceException("Unable to get driver instance for jdbcUrl: " + jdbcUrl); - } + + try { + if (!lock.tryLock(60L, TimeUnit.SECONDS)) { + druidDataSource = dataSourceMap.get(key); + if (druidDataSource != null && !druidDataSource.isClosed()) { + return druidDataSource; + } + throw new SourceException("Unable to get datasource for jdbcUrl: " + jdbcUrl); + } + } + catch (InterruptedException e) { + throw new SourceException("Unable to get datasource for jdbcUrl: " + jdbcUrl); + } + + druidDataSource = dataSourceMap.get(key); + if (druidDataSource != null && !druidDataSource.isClosed()) { + lock.unlock(); + return druidDataSource; + } druidDataSource = dataSourceMap.get(key); if (druidDataSource != null && !druidDataSource.isClosed()) { @@ -112,9 +111,15 @@ public DruidDataSource getDataSource(JdbcSourceInfo jdbcSourceInfo) throws Sourc properties.setProperty(PROP_MAXWAIT, String.valueOf(maxWait)); properties.setProperty(PROP_TIMEBETWEENEVICTIONRUNSMILLIS, String.valueOf(timeBetweenEvictionRunsMillis)); properties.setProperty(PROP_MINEVICTABLEIDLETIMEMILLIS, String.valueOf(minEvictableIdleTimeMillis)); - properties.setProperty(PROP_TESTWHILEIDLE, String.valueOf(false)); + properties.setProperty(PROP_MAXOPENPREPAREDSTATEMENTS, String.valueOf(maxEvictableIdleTimeMillis)); + properties.setProperty(PROP_TESTWHILEIDLE, String.valueOf(testWhileIdle)); properties.setProperty(PROP_TESTONBORROW, String.valueOf(testOnBorrow)); properties.setProperty(PROP_TESTONRETURN, String.valueOf(testOnReturn)); + properties.setProperty(PROP_VALIDATIONQUERY, validationQuery); + properties.setProperty(PROP_VALIDATIONQUERY_TIMEOUT, String.valueOf(validationQueryTimeout)); + properties.setProperty(PROP_REMOVEABANDONED, "true"); + properties.setProperty(PROP_REMOVEABANDONEDTIMEOUT, "3900"); + properties.setProperty(PROP_LOGABANDONED, "true"); properties.put(PROP_CONNECTIONPROPERTIES, "client.transport.ignore_cluster_name=true"); if (!CollectionUtils.isEmpty(jdbcSourceInfo.getProperties())) { @@ -138,42 +143,43 @@ public DruidDataSource getDataSource(JdbcSourceInfo jdbcSourceInfo) throws Sourc @Autowired private ESDataSource esDataSource; - @Value("${spring.datasource.type}") - protected String type; - - @Value("${source.max-active:10}") + @Value("${source.max-active:8}") @Getter protected int maxActive; - @Value("${source.initial-size:1}") + @Value("${source.initial-size:0}") @Getter protected int initialSize; - @Value("${source.min-idle:3}") + @Value("${source.min-idle:1}") @Getter protected int minIdle; - @Value("${source.max-wait:30000}") + @Value("${source.max-wait:60000}") @Getter protected long maxWait; - @Value("${spring.datasource.time-between-eviction-runs-millis}") + @Value("${source.time-between-eviction-runs-millis}") @Getter protected long timeBetweenEvictionRunsMillis; - @Value("${spring.datasource.min-evictable-idle-time-millis}") + @Value("${source.min-evictable-idle-time-millis}") @Getter protected long minEvictableIdleTimeMillis; - @Value("${spring.datasource.test-while-idle}") + @Value("${source.max-evictable-idle-time-millis}") + @Getter + protected long maxEvictableIdleTimeMillis; + + @Value("${source.test-while-idle}") @Getter protected boolean testWhileIdle; - @Value("${spring.datasource.test-on-borrow}") + @Value("${source.test-on-borrow}") @Getter protected boolean testOnBorrow; - @Value("${spring.datasource.test-on-return}") + @Value("${source.test-on-return}") @Getter protected boolean testOnReturn; @@ -181,13 +187,25 @@ public DruidDataSource getDataSource(JdbcSourceInfo jdbcSourceInfo) throws Sourc @Getter protected boolean breakAfterAcquireFailure; - @Value("${source.connection-error-retry-attempts:0}") + @Value("${source.connection-error-retry-attempts:1}") @Getter protected int connectionErrorRetryAttempts; - @Value("${source.query-timeout:600000}") + @Value("${source.keep-alive:false}") @Getter - protected int queryTimeout; + protected boolean keepAlive; + + @Value("${source.validation-query-timeout:5}") + @Getter + protected int validationQueryTimeout; + + @Value("${source.validation-query}") + @Getter + protected String validationQuery; + + @Value("${source.filters}") + @Getter + protected String filters; private static volatile Map dataSourceMap = new ConcurrentHashMap<>(); private static volatile Map dataSourceLockMap = new ConcurrentHashMap<>(); @@ -223,7 +241,7 @@ public void removeDatasource(JdbcSourceInfo jdbcSourceInfo) { String key = getDataSourceKey(jdbcSourceInfo); Lock lock = getDataSourceLock(key); - + if (!lock.tryLock()) { return; } @@ -262,16 +280,21 @@ public DruidDataSource getDataSource(JdbcSourceInfo jdbcSourceInfo) throws Sourc Lock lock = getDataSourceLock(key); try { - if (!lock.tryLock(5L, TimeUnit.SECONDS)) { - throw new SourceException("Unable to get driver instance for jdbcUrl: " + jdbcUrl); + if (!lock.tryLock(30L, TimeUnit.SECONDS)) { + druidDataSource = dataSourceMap.get(key); + if (druidDataSource != null && !druidDataSource.isClosed()) { + return druidDataSource; + } + throw new SourceException("Unable to get datasource for jdbcUrl: " + jdbcUrl); } } catch (InterruptedException e) { - throw new SourceException("Unable to get driver instance for jdbcUrl: " + jdbcUrl); + throw new SourceException("Unable to get datasource for jdbcUrl: " + jdbcUrl); } druidDataSource = dataSourceMap.get(key); if (druidDataSource != null && !druidDataSource.isClosed()) { + lock.unlock(); return druidDataSource; } @@ -310,17 +333,30 @@ public DruidDataSource getDataSource(JdbcSourceInfo jdbcSourceInfo) throws Sourc druidDataSource.setMaxWait(maxWait); druidDataSource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); druidDataSource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); - druidDataSource.setTestWhileIdle(false); + druidDataSource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis); + druidDataSource.setTestWhileIdle(testWhileIdle); druidDataSource.setTestOnBorrow(testOnBorrow); druidDataSource.setTestOnReturn(testOnReturn); druidDataSource.setConnectionErrorRetryAttempts(connectionErrorRetryAttempts); druidDataSource.setBreakAfterAcquireFailure(breakAfterAcquireFailure); - - String driverName=druidDataSource.getDriverClassName(); - if(driverName.indexOf("sqlserver")!=-1) { + druidDataSource.setKeepAlive(keepAlive); + druidDataSource.setValidationQueryTimeout(validationQueryTimeout); + druidDataSource.setValidationQuery(validationQuery); + druidDataSource.setRemoveAbandoned(true); + druidDataSource.setRemoveAbandonedTimeout(3600 + 5 * 60); + druidDataSource.setLogAbandoned(true); + + // default validation query + String driverName = druidDataSource.getDriverClassName(); + if (driverName.indexOf("sqlserver") != -1 || driverName.indexOf("mysql") != -1 + || driverName.indexOf("h2") != -1 || driverName.indexOf("moonbox") != -1) { druidDataSource.setValidationQuery("select 1"); } + if (driverName.indexOf("oracle") != -1) { + druidDataSource.setValidationQuery("select 1 from dual"); + } + if (!CollectionUtils.isEmpty(jdbcSourceInfo.getProperties())) { Properties properties = new Properties(); jdbcSourceInfo.getProperties().forEach(dict -> properties.setProperty(dict.getKey(), dict.getValue())); @@ -328,6 +364,7 @@ public DruidDataSource getDataSource(JdbcSourceInfo jdbcSourceInfo) throws Sourc } try { + druidDataSource.setFilters(filters); druidDataSource.init(); } catch (Exception e) { log.error("Exception during pool initialization", e); diff --git a/server/src/main/java/edp/core/config/DruidConfig.java b/server/src/main/java/edp/core/config/DruidConfig.java index f86fe8ba4..e83d8d0dd 100644 --- a/server/src/main/java/edp/core/config/DruidConfig.java +++ b/server/src/main/java/edp/core/config/DruidConfig.java @@ -72,6 +72,9 @@ public class DruidConfig { @Value("${spring.datasource.min-evictable-idle-time-millis}") private int minEvictableIdleTimeMillis; + @Value("${spring.datasource.max-evictable-idle-time-millis}") + private int maxEvictableIdleTimeMillis; + @Value("${spring.datasource.test-while-idle}") private boolean testWhileIdle; @@ -93,6 +96,9 @@ public class DruidConfig { @Value("${spring.datasource.validation-query}") private String validationQuery; + @Value("${spring.datasource.validation-query-timeout}") + private int validationQueryTime; + /** * druid监控 * @@ -139,12 +145,14 @@ public DruidDataSource druidDataSource() { druidDataSource.setMaxWait(maxWait); druidDataSource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); druidDataSource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); + druidDataSource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis); druidDataSource.setTestWhileIdle(testWhileIdle); druidDataSource.setTestOnBorrow(testOnBorrow); druidDataSource.setTestOnReturn(testOnReturn); druidDataSource.setBreakAfterAcquireFailure(breakAfterAcquireFailure); druidDataSource.setConnectionErrorRetryAttempts(connectionErrorRetryAttempts); druidDataSource.setValidationQuery(validationQuery); + druidDataSource.setValidationQueryTimeout(validationQueryTime); try { druidDataSource.setFilters(filters); diff --git a/server/src/main/java/edp/core/utils/DateUtils.java b/server/src/main/java/edp/core/utils/DateUtils.java index d2ceb0933..3d6b4be5a 100644 --- a/server/src/main/java/edp/core/utils/DateUtils.java +++ b/server/src/main/java/edp/core/utils/DateUtils.java @@ -314,4 +314,30 @@ public static java.sql.Date toSqlDate(Long timeLongInMicros) { return toSqlDate(new Date(timeLongInMicros)); } + public static Date dateFormat(String date, String dateFormat) { + if (date == null) { + return null; + } + SimpleDateFormat format = new SimpleDateFormat(dateFormat); + try { + return format.parse(date); + } catch (Exception ex) { + + } + return null; + } + + public static String dateFormat(Date date, String dateFormat) { + if (date == null) { + return ""; + } + SimpleDateFormat format = new SimpleDateFormat(dateFormat); + try { + return format.format(date); + } catch (Exception ex) { + + } + return ""; + } + } diff --git a/server/src/main/java/edp/core/utils/FileUtils.java b/server/src/main/java/edp/core/utils/FileUtils.java index 4aaf8660b..5ccd22220 100644 --- a/server/src/main/java/edp/core/utils/FileUtils.java +++ b/server/src/main/java/edp/core/utils/FileUtils.java @@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; +import org.springframework.util.FileCopyUtils; import org.springframework.web.multipart.MultipartFile; import javax.imageio.ImageIO; @@ -367,4 +368,13 @@ public static void closeCloseable(Closeable c) { } } } + + public static int copy(File in, File out) { + try { + return FileCopyUtils.copy(in, out); + } catch (IOException e) { + e.printStackTrace(); + } + return -1; + } } diff --git a/server/src/main/java/edp/core/utils/SourceUtils.java b/server/src/main/java/edp/core/utils/SourceUtils.java index 459f1e708..731a9088a 100644 --- a/server/src/main/java/edp/core/utils/SourceUtils.java +++ b/server/src/main/java/edp/core/utils/SourceUtils.java @@ -34,6 +34,8 @@ import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.HashSet; +import java.util.Set; import java.util.regex.Matcher; import javax.sql.DataSource; @@ -49,6 +51,7 @@ import edp.core.model.CustomDataSource; import edp.core.model.JdbcSourceInfo; import edp.davinci.runner.LoadSupportDataSourceRunner; +import lombok.Getter; import lombok.extern.slf4j.Slf4j; @Slf4j @@ -56,73 +59,97 @@ public class SourceUtils { private JdbcDataSource jdbcDataSource; + @Getter + private static Set releaseSourceSet = new HashSet(); + public SourceUtils(JdbcDataSource jdbcDataSource) { this.jdbcDataSource = jdbcDataSource; } /** - * 获取数据源 + * 测试数据源 * * @param jdbcSourceInfo * @return * @throws SourceException */ - DataSource getDataSource(JdbcSourceInfo jdbcSourceInfo) throws SourceException { - return jdbcDataSource.getDataSource(jdbcSourceInfo); - } + public boolean testSource(JdbcSourceInfo jdbcSourceInfo) { - Connection getConnection(JdbcSourceInfo jdbcSourceInfo) throws SourceException { - DataSource dataSource = getDataSource(jdbcSourceInfo); - Connection connection = null; try { - connection = dataSource.getConnection(); - } catch (Exception e) { + Class.forName(getDriverClassName(jdbcSourceInfo.getJdbcUrl(), jdbcSourceInfo.getDbVersion())); + } catch (ClassNotFoundException e) { + log.error(e.toString(), e); + return false; + } + try (Connection con = DriverManager.getConnection(jdbcSourceInfo.getJdbcUrl(), jdbcSourceInfo.getUsername(), jdbcSourceInfo.getPassword());) { + return con != null; + } catch (SQLException e) { + log.error(e.toString(), e); } - - try { - if (null == connection) { - log.info("connection is closed, retry get connection!"); + + return false; + } + + /** + * 获取数据源 + * + * @param jdbcSourceInfo + * @return + * @throws SourceException + */ + public DataSource getDataSource(JdbcSourceInfo jdbcSourceInfo) throws SourceException { + return jdbcDataSource.getDataSource(jdbcSourceInfo); + } + + public Connection getConnection(JdbcSourceInfo jdbcSourceInfo) throws SourceException { + Connection conn = getConnectionWithRetry(jdbcSourceInfo); + if (conn == null) { + try { releaseDataSource(jdbcSourceInfo); - dataSource = getDataSource(jdbcSourceInfo); - connection = dataSource.getConnection(); + DataSource dataSource = getDataSource(jdbcSourceInfo); + return dataSource.getConnection(); + } catch (Exception e) { + log.error("get connection error, jdbcUrl: {}", jdbcSourceInfo.getJdbcUrl()); + throw new SourceException("get connection error, jdbcUrl: " + jdbcSourceInfo.getJdbcUrl() + " you can try again later or reset datasource"); } - } catch (Exception e) { - log.error("create connection error, jdbcUrl: {}", jdbcSourceInfo.getJdbcUrl()); - throw new SourceException("create connection error, jdbcUrl: " + jdbcSourceInfo.getJdbcUrl()); } + return conn; + } - try { - if (!connection.isValid(5)) { - log.info("connection is invalid, retry get connection!"); - releaseDataSource(jdbcSourceInfo); - connection = null; + private Connection getConnectionWithRetry(JdbcSourceInfo jdbcSourceInfo) { + int rc = 1; + for (; ; ) { + + if (rc > 3) { + return null; } - } catch (Exception e) { - } + try { + Connection connection = getDataSource(jdbcSourceInfo).getConnection(); + if (connection != null && connection.isValid(5)) { + return connection; + } + } catch (Exception e) { + + } - if (null == connection) { try { - dataSource = getDataSource(jdbcSourceInfo); - connection = dataSource.getConnection(); - } catch (SQLException e) { - log.error("create connection error, jdbcUrl: {}", jdbcSourceInfo.getJdbcUrl()); - throw new SourceException("create connection error, jdbcUrl: " + jdbcSourceInfo.getJdbcUrl()); + Thread.sleep((long) Math.pow(2, rc) * 1000); + } catch (InterruptedException e) { + } - } - return connection; + rc++; + } } public static void releaseConnection(Connection connection) { if (null != connection) { try { connection.close(); - connection = null; } catch (Exception e) { - e.printStackTrace(); - log.error("connection close error", e.getMessage()); + log.error("connection release error", e.getMessage()); } } } @@ -131,9 +158,7 @@ public static void closeResult(ResultSet rs) { if (rs != null) { try { rs.close(); - rs = null; } catch (Exception e) { - e.printStackTrace(); log.error("resultSet close error", e.getMessage()); } } diff --git a/server/src/main/java/edp/core/utils/SqlUtils.java b/server/src/main/java/edp/core/utils/SqlUtils.java index 2b4cbd703..be0dfff36 100644 --- a/server/src/main/java/edp/core/utils/SqlUtils.java +++ b/server/src/main/java/edp/core/utils/SqlUtils.java @@ -30,6 +30,7 @@ import edp.davinci.core.enums.LogNameEnum; import edp.davinci.core.enums.SqlColumnEnum; import edp.davinci.core.utils.SqlParseUtils; +import edp.davinci.model.Source; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import net.sf.jsqlparser.JSQLParserException; @@ -464,7 +465,7 @@ public List getTableList(String dbName) throws SourceException { try { connection = sourceUtils.getConnection(this.jdbcSourceInfo); if (null == connection) { - return tableList; + return null; } DatabaseMetaData metaData = connection.getMetaData(); @@ -477,7 +478,7 @@ public List getTableList(String dbName) throws SourceException { tables = metaData.getTables(dbName, getDBSchemaPattern(schema), "%", TABLE_TYPES); if (null == tables) { - return tableList; + return null; } tableList = new ArrayList<>(); @@ -494,11 +495,11 @@ public List getTableList(String dbName) throws SourceException { } } } catch (Exception e) { - log.error(e.getMessage(), e); + log.error(e.toString(), e); return tableList; } finally { - SourceUtils.releaseConnection(connection); SourceUtils.closeResult(tables); + SourceUtils.releaseConnection(connection); } return tableList; } @@ -549,7 +550,7 @@ public TableInfo getTableInfo(String dbName, String tableName) throws SourceExce tableInfo = new TableInfo(tableName, primaryKeys, columns); } } catch (SQLException e) { - log.error(e.getMessage(), e); + log.error(e.toString(), e); throw new SourceException(e.getMessage() + ", jdbcUrl=" + this.jdbcSourceInfo.getJdbcUrl()); } finally { SourceUtils.releaseConnection(connection); @@ -580,11 +581,11 @@ public boolean tableIsExist(String tableName) throws SourceException { } } } catch (Exception e) { - log.error(e.getMessage(), e); + log.error(e.toString(), e); throw new SourceException("Get connection meta data error, jdbcUrl=" + this.jdbcSourceInfo.getJdbcUrl()); } finally { - SourceUtils.releaseConnection(connection); SourceUtils.closeResult(rs); + SourceUtils.releaseConnection(connection); } return result; } @@ -664,38 +665,28 @@ public static void checkSensitiveSql(String sql) throws ServerException { } } - public JdbcTemplate jdbcTemplate() throws SourceException { Connection connection = null; try { - connection = sourceUtils.getConnection(this.jdbcSourceInfo); - } catch (SourceException e) { - } - if (connection == null) { - sourceUtils.releaseDataSource(this.jdbcSourceInfo); - } else { + connection = sourceUtils.getConnection(jdbcSourceInfo); + } finally { SourceUtils.releaseConnection(connection); } - DataSource dataSource = sourceUtils.getDataSource(this.jdbcSourceInfo); + DataSource dataSource = sourceUtils.getDataSource(jdbcSourceInfo); JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); jdbcTemplate.setFetchSize(500); return jdbcTemplate; } public boolean testConnection() throws SourceException { - Connection connection = null; - try { - connection = sourceUtils.getConnection(jdbcSourceInfo); + try (Connection connection = sourceUtils.getConnection(jdbcSourceInfo);) { if (null != connection) { return true; } else { return false; } - } catch (SourceException sourceException) { - throw sourceException; - } finally { - SourceUtils.releaseConnection(connection); - sourceUtils.releaseDataSource(jdbcSourceInfo); + } catch (Exception e) { + throw new SourceException(e.getMessage()); } } diff --git a/server/src/main/java/edp/davinci/dto/cronJobDto/MsgMailExcel.java b/server/src/main/java/edp/davinci/dto/cronJobDto/MsgMailExcel.java index ee13b94e1..915781629 100644 --- a/server/src/main/java/edp/davinci/dto/cronJobDto/MsgMailExcel.java +++ b/server/src/main/java/edp/davinci/dto/cronJobDto/MsgMailExcel.java @@ -43,6 +43,6 @@ public MsgMailExcel(Long id) { @Override public String toString() { - return "Date: " + DateUtils.toyyyyMMddHHmmss(date) + ", exception: {" + exception.getMessage() + "}"; + return "Date:" + DateUtils.dateFormat(date, "yyyy-MM-dd HH:ss:mm") + ", exception:" + exception.getMessage(); } } diff --git a/server/src/main/java/edp/davinci/service/excel/ExecutorUtil.java b/server/src/main/java/edp/davinci/service/excel/ExecutorUtil.java index 67b6d4399..951f45308 100644 --- a/server/src/main/java/edp/davinci/service/excel/ExecutorUtil.java +++ b/server/src/main/java/edp/davinci/service/excel/ExecutorUtil.java @@ -41,24 +41,24 @@ public class ExecutorUtil { public static final ExecutorService SHEET_WORKERS = Executors.newFixedThreadPool(16, new ThreadFactoryBuilder().setNameFormat("Sheet-worker-%d").setDaemon(true).build()); - public static Future submitWorkbookTask(WorkbookWorker worker, Logger customLogger) { - printThreadPoolStatusLog(WORKBOOK_WORKERS, "WORKBOOK_WORKERS", customLogger); - return ExecutorUtil.WORKBOOK_WORKERS.submit(worker); - } - public static Future submitWorkbookTask(WorkBookContext context, Logger customLogger) { return ExecutorUtil.submitWorkbookTask(new WorkbookWorker(context), customLogger); } - public static Future submitSheetTask(SheetWorker worker, Logger customLogger) { - printThreadPoolStatusLog(SHEET_WORKERS, "SHEET_WORKERS", customLogger); - return ExecutorUtil.SHEET_WORKERS.submit(worker); + private static Future submitWorkbookTask(WorkbookWorker worker, Logger customLogger) { + printThreadPoolStatusLog(WORKBOOK_WORKERS, "WORKBOOK_WORKERS", customLogger); + return ExecutorUtil.WORKBOOK_WORKERS.submit(worker); } public static Future submitSheetTask(SheetContext context, Logger customLogger) { return ExecutorUtil.submitSheetTask(new SheetWorker(context), customLogger); } + private static Future submitSheetTask(SheetWorker worker, Logger customLogger) { + printThreadPoolStatusLog(SHEET_WORKERS, "SHEET_WORKERS", customLogger); + return ExecutorUtil.SHEET_WORKERS.submit(worker); + } + public static void printThreadPoolStatusLog(ExecutorService executorService, String serviceName, Logger customLogger) { ThreadPoolExecutor executor = (ThreadPoolExecutor) executorService; Object[] args = { diff --git a/server/src/main/java/edp/davinci/service/excel/SheetWorker.java b/server/src/main/java/edp/davinci/service/excel/SheetWorker.java index 5579ecf91..d0e0a4aa2 100644 --- a/server/src/main/java/edp/davinci/service/excel/SheetWorker.java +++ b/server/src/main/java/edp/davinci/service/excel/SheetWorker.java @@ -59,12 +59,17 @@ public SheetWorker(SheetContext context) { @Override public T call() { + Stopwatch watch = Stopwatch.createStarted(); Boolean rst = true; String md5 = null; Logger logger = context.getCustomLogger(); boolean log = context.getCustomLogger() != null; + try { + + interrupted(context); + SqlUtils utils = context.getSqlUtils(); JdbcTemplate template = utils.jdbcTemplate(); propertiesSet(template); @@ -72,8 +77,7 @@ public T call() { super.init(context); super.writeHeader(context); template.setMaxRows(context.getResultLimit() > 0 && context.getResultLimit() <= maxRows ? context.getResultLimit() : maxRows); - template.setFetchSize(500); - + // special for mysql if(utils.getDataTypeEnum() == DataTypeEnum.MYSQL) { template.setFetchSize(Integer.MIN_VALUE); @@ -84,27 +88,30 @@ public T call() { md5 = MD5Util.getMD5(sql, true, 16); Set queryFromsAndJoins = SqlUtils.getQueryFromsAndJoins(sql); if (log) { - logger.info("Task({}) sheet worker(name:{}, sheetNo:{}, sheetName:{}) start query sql:{}, md5:{}", + logger.info("Task({}) sheet worker(name:{}, sheetNo:{}, sheetName:{}) query start sql:{}, md5:{}", context.getTaskKey(), context.getName(), context.getSheetNo(), context.getSheet().getSheetName(), SqlUtils.formatSql(sql), md5); } final AtomicInteger count = new AtomicInteger(0); template.query(sql, rs -> { + + interrupted(context); + Map dataMap = Maps.newHashMap(); for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) { dataMap.put(SqlUtils.getColumnLabel(queryFromsAndJoins, rs.getMetaData().getColumnLabel(i)), rs.getObject(rs.getMetaData().getColumnLabel(i))); } - if (log) { - logger.info("data map:{}", dataMap.toString()); - } writeLine(context, dataMap); count.incrementAndGet(); }); + if (log) { - logger.info("Task({}) sheet worker(name:{}, sheetNo:{}, sheetName:{}) finish query md5:{}, count:{}", + logger.info("Task({}) sheet worker(name:{}, sheetNo:{}, sheetName:{}) query finish md5:{}, count:{}", context.getTaskKey(), context.getName(), context.getSheetNo(), context.getSheet().getSheetName(), md5, count.get()); } + super.refreshHeightWidth(context); + } catch (Exception e) { if (context.getWrapper().getAction() == ActionEnum.MAIL) { MsgMailExcel msg = (MsgMailExcel) context.getWrapper().getMsg(); @@ -112,7 +119,7 @@ public T call() { msg.setException(e); } if (log) { - logger.error("Task({}) sheet worker(name:{}, sheetNo:{}, sheetName:{}) error query md5:{}", + logger.error("Task({}) sheet worker(name:{}, sheetNo:{}, sheetName:{}) query error md5:{}", context.getTaskKey(), context.getName(), context.getSheetNo(), context.getSheet().getSheetName(), md5); logger.error(e.toString(), e); } @@ -131,6 +138,18 @@ public T call() { return (T) rst; } + private void interrupted(SheetContext context) { + if (Thread.interrupted()) { + Logger logger = context.getCustomLogger(); + boolean log = context.getCustomLogger() != null; + if (log) { + logger.error("Task({}) sheet worker(name:{}, sheetNo:{}, sheetName:{}) interrupted", + context.getTaskKey(), context.getName(), context.getSheetNo(), context.getSheet().getSheetName()); + } + throw new RuntimeException("Task(" + context.getTaskKey() + ") sheet worker(name:" + context.getName() + ", " + + "sheetNo:" + context.getSheetNo() + ", sheetName:" + context.getSheet().getSheetName() + ") interrupted"); + } + } private void propertiesSet(JdbcTemplate template) { if (!CollectionUtils.isEmpty(context.getExecuteSql())) { diff --git a/server/src/main/java/edp/davinci/service/excel/WorkbookWorker.java b/server/src/main/java/edp/davinci/service/excel/WorkbookWorker.java index 1915e126e..a3f017297 100644 --- a/server/src/main/java/edp/davinci/service/excel/WorkbookWorker.java +++ b/server/src/main/java/edp/davinci/service/excel/WorkbookWorker.java @@ -75,11 +75,13 @@ public T call() throws Exception { String filePath = null; try { + List sheetContextList = buildSheetContextList(); if (CollectionUtils.isEmpty(sheetContextList)) { throw new IllegalArgumentException( "Task(" + context.getTaskKey() + ") workbook worker sheetContextList is empty"); } + wb = new SXSSFWorkbook(1000); List futures = Lists.newArrayList(); int sheetNo = 0; @@ -94,25 +96,28 @@ public T call() throws Exception { futures.add(future); } - Boolean rst = false; + Boolean rst = true; try { for (Future future : futures) { - rst = future.get(1, TimeUnit.HOURS); - if (!rst) { - future.cancel(true); + if (!future.get(1, TimeUnit.HOURS)) { + rst = false; + break; } } } catch (InterruptedException | ExecutionException | TimeoutException e) { + + rst = false; + if (log) { - logger.error("Task({}) workbook worker error", context.getTaskKey()); + logger.error("Task({}) workbook worker execute error", context.getTaskKey()); logger.error(e.toString(), e); } - - if (e instanceof TimeoutException && wrapper.getAction() == ActionEnum.MAIL) { + + if (wrapper.getAction() == ActionEnum.MAIL) { MsgMailExcel msg = (MsgMailExcel) wrapper.getMsg(); - msg.setException(new TimeoutException("Get data timeout")); + msg.setException(e); super.tell(wrapper); - return (T) filePath; + return null; } } @@ -122,20 +127,27 @@ public T call() throws Exception { wb.write(out); out.flush(); } catch (Exception e) { - filePath = null; + workbookDispose(wb); throw e; } wrapper.setRst(filePath); } else { if (log) { - logger.info("Task({}) sheet worker result false action={}, xid={}", logArgs); + logger.info("Task({}) sheet worker execute fail action={}, xid={}", logArgs); + } + + for (Future future : futures) { + future.cancel(true); } + wrapper.setRst(null); } + super.tell(wrapper); + } catch (Exception e) { if (log) { - logger.error("Task({}) workbook worker error", context.getTaskKey()); + logger.error("Task({}) workbook worker execute error", context.getTaskKey()); logger.error(e.toString(), e); } @@ -144,12 +156,14 @@ public T call() throws Exception { msg.setException(e); } - super.tell(wrapper); if (StringUtils.isNotEmpty(filePath)) { FileUtils.delete(filePath); } + + super.tell(wrapper); + } finally { - wb = null; + workbookDispose(wb); } if (wrapper.getAction() == ActionEnum.DOWNLOAD) { @@ -157,7 +171,9 @@ public T call() throws Exception { if (log) { logger.info("Task({}) workbook worker complete status={}, action={}, xid={}, filePath={}, cost={}ms", args); } - } else if (wrapper.getAction() == ActionEnum.SHAREDOWNLOAD || wrapper.getAction() == ActionEnum.MAIL) { + } + + if (wrapper.getAction() == ActionEnum.SHAREDOWNLOAD || wrapper.getAction() == ActionEnum.MAIL) { Object[] args = {context.getTaskKey(), StringUtils.isNotEmpty(filePath), wrapper.getAction(), wrapper.getxUUID(), filePath, watch.elapsed(TimeUnit.MILLISECONDS)}; if (log) { logger.info("Task({}) workbook worker complete status={}, action={}, xUUID={}, filePath={}, cost={}ms", args); @@ -167,6 +183,11 @@ public T call() throws Exception { return (T) filePath; } + private void workbookDispose(Workbook wb) { + if (wb != null) { + ((SXSSFWorkbook)wb).dispose(); + } + } private List buildSheetContextList() throws Exception { List sheetContextList = Lists.newArrayList(); diff --git a/server/src/main/java/edp/davinci/service/impl/SourceMessageHandler.java b/server/src/main/java/edp/davinci/service/impl/SourceMessageHandler.java index 9ad6ed4f8..2cf9d8407 100644 --- a/server/src/main/java/edp/davinci/service/impl/SourceMessageHandler.java +++ b/server/src/main/java/edp/davinci/service/impl/SourceMessageHandler.java @@ -44,13 +44,17 @@ public class SourceMessageHandler implements RedisMessageHandler { @Override public void handle(Object message, String flag) { - // the flag is deprecated - log.info("SourceHandler received release source message (:{}), and Flag is (:{})", message, flag); + log.info("SourceHandler received release source message({}), id({})", message, flag); if (!(message instanceof String)) { return; } - + + if (SourceUtils.getReleaseSourceSet().contains(flag)) { + SourceUtils.getReleaseSourceSet().remove(flag); + return; + } + Map map = JSON.parseObject((String)message, Map.class); SourceUtils sourceUtils = new SourceUtils(jdbcDataSource); diff --git a/server/src/main/java/edp/davinci/service/impl/SourceServiceImpl.java b/server/src/main/java/edp/davinci/service/impl/SourceServiceImpl.java index 7e6dcc3f4..352e726a3 100644 --- a/server/src/main/java/edp/davinci/service/impl/SourceServiceImpl.java +++ b/server/src/main/java/edp/davinci/service/impl/SourceServiceImpl.java @@ -50,6 +50,7 @@ import edp.davinci.runner.LoadSupportDataSourceRunner; import edp.davinci.service.ProjectService; import edp.davinci.service.SourceService; +import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -347,7 +348,7 @@ public boolean deleteSrouce(Long id, User user) throws NotFoundException, UnAuth } /** - * 测试连接 + * 测试数据源 * * @param sourceTest * @return @@ -369,18 +370,20 @@ public boolean testSource(SourceTest sourceTest) throws ServerException { sourceTest.setExt(false); } - testConnection = sqlUtils - .init( - sourceTest.getUrl(), - sourceTest.getUsername(), - sourceTest.getPassword(), - sourceTest.getVersion(), - sourceTest.getProperties(), - sourceTest.isExt() - ).testConnection(); + JdbcSourceInfo jdbcSourceInfo = JdbcSourceInfoBuilder + .aJdbcSourceInfo() + .withJdbcUrl(sourceTest.getUrl()) + .withUsername(sourceTest.getUsername()) + .withPassword(sourceTest.getPassword()) + .withProperties(sourceTest.getProperties()) + .withExt(sourceTest.isExt()) + .withDbVersion(sourceTest.getVersion()) + .build(); + + testConnection = new SourceUtils(jdbcDataSource).testSource(jdbcSourceInfo); } catch (SourceException e) { - log.error(e.getMessage()); + log.error(e.toString(), e); throw new ServerException(e.getMessage()); } @@ -623,6 +626,18 @@ public boolean reconnect(Long id, DbBaseInfo dbBaseInfo, User user) */ private void releaseSource(Source source) { + SourceUtils sourceUtils = new SourceUtils(jdbcDataSource); + JdbcSourceInfo jdbcSourceInfo = JdbcSourceInfoBuilder + .aJdbcSourceInfo() + .withJdbcUrl(source.getJdbcUrl()) + .withUsername(source.getUsername()) + .withPassword(source.getPassword()) + .withDbVersion(source.getDbVersion()) + .withExt(source.isExt()) + .build(); + + sourceUtils.releaseDataSource(jdbcSourceInfo); + if (redisUtils.isRedisEnable()) { Map map = new HashMap<>(); @@ -632,21 +647,8 @@ private void releaseSource(Source source) { map.put("version", source.getDbVersion()); map.put("ext", source.isExt()); - publishReconnect(JSON.toJSONString(map)); - } else { - SourceUtils sourceUtils = new SourceUtils(jdbcDataSource); - JdbcSourceInfo jdbcSourceInfo = JdbcSourceInfoBuilder - .aJdbcSourceInfo() - .withJdbcUrl(source.getJdbcUrl()) - .withUsername(source.getUsername()) - .withPassword(source.getPassword()) - .withDatabase(source.getDatabase()) - .withDbVersion(source.getDbVersion()) - .withProperties(source.getProperties()) - .withExt(source.isExt()) - .build(); - - sourceUtils.releaseDataSource(jdbcSourceInfo); + SourceUtils.getReleaseSourceSet().add(String.valueOf(source.getId())); + publishReconnect(JSON.toJSONString(map), source.getId()); } } @@ -654,27 +656,24 @@ private void releaseSource(Source source) { * 向redis发布reconnect消息 * * @param message + * @param id */ - private void publishReconnect(String message) { - - // String flag = MD5Util.getMD5(UUID.randomUUID().toString() + id, true, 32); - // the flag is deprecated - String flag = "-1"; - redisUtils.convertAndSend(DAVINCI_TOPIC_CHANNEL, new RedisMessageEntity(SourceMessageHandler.class, message, flag)); + private void publishReconnect(String message, Long id) { + redisUtils.convertAndSend(DAVINCI_TOPIC_CHANNEL, new RedisMessageEntity(SourceMessageHandler.class, message, String.valueOf(id))); } /** * 建表 * - * @param fileds + * @param fields * @param sourceDataUpload * @param source * @throws ServerException */ - private void createTable(Set fileds, SourceDataUpload sourceDataUpload, Source source) + private void createTable(Set fields, SourceDataUpload sourceDataUpload, Source source) throws ServerException { - if (CollectionUtils.isEmpty(fileds)) { + if (CollectionUtils.isEmpty(fields)) { throw new ServerException("there is have not any fields"); } @@ -687,7 +686,7 @@ private void createTable(Set fileds, SourceDataUpload sourceDataUpl if (sourceDataUpload.getMode() == UploadModeEnum.COVER.getMode()) { ST st = stg.getInstanceOf("createTable"); st.add("tableName", sourceDataUpload.getTableName()); - st.add("fields", fileds); + st.add("fields", fields); st.add("primaryKeys", StringUtils.isEmpty(sourceDataUpload.getPrimaryKeys()) ? null : sourceDataUpload.getPrimaryKeys().split(",")); st.add("indexKeys", sourceDataUpload.getIndexList()); @@ -701,7 +700,7 @@ private void createTable(Set fileds, SourceDataUpload sourceDataUpl if (!tableIsExist) { ST st = stg.getInstanceOf("createTable"); st.add("tableName", sourceDataUpload.getTableName()); - st.add("fields", fileds); + st.add("fields", fields); st.add("primaryKeys", sourceDataUpload.getPrimaryKeys()); st.add("indexKeys", sourceDataUpload.getIndexList()); diff --git a/server/src/main/java/edp/davinci/service/screenshot/ScreenshotUtil.java b/server/src/main/java/edp/davinci/service/screenshot/ScreenshotUtil.java index c027af304..25287441d 100644 --- a/server/src/main/java/edp/davinci/service/screenshot/ScreenshotUtil.java +++ b/server/src/main/java/edp/davinci/service/screenshot/ScreenshotUtil.java @@ -20,7 +20,9 @@ package edp.davinci.service.screenshot; import com.alibaba.druid.util.StringUtils; -import edp.core.exception.ServerException; +import edp.core.consts.Consts; +import edp.core.utils.DateUtils; +import edp.core.utils.FileUtils; import edp.davinci.core.enums.LogNameEnum; import lombok.extern.slf4j.Slf4j; import org.openqa.selenium.*; @@ -40,8 +42,10 @@ import org.openqa.selenium.support.ui.WebDriverWait; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; +import org.springframework.util.FileCopyUtils; import java.io.File; import java.net.MalformedURLException; @@ -80,6 +84,9 @@ public class ScreenshotUtil { private static final ExecutorService executorService = Executors.newFixedThreadPool(8); + @Autowired + private FileUtils fileUtils; + public void screenshot(long jobId, List imageContents, Integer imageWidth) { scheduleLogger.info("Start screenshot for job({})", jobId); try { @@ -121,7 +128,7 @@ private File doScreenshot(long jobId, String url, Integer imageWidth) throws Exc WebDriver driver = generateWebDriver(jobId, imageWidth); driver.get(url); - scheduleLogger.info("Cronjob({}) do screenshot for url[timeout={}]({}) start", jobId, timeOutSecond,url); + scheduleLogger.info("Cronjob({}) do screenshot url={}, timeout={} start", jobId, url, timeOutSecond); try { WebDriverWait wait = new WebDriverWait(driver, timeOutSecond); ExpectedCondition ConditionOfSign = ExpectedConditions.presenceOfElementLocated(By.id("headlessBrowserRenderSign")); @@ -146,11 +153,20 @@ private File doScreenshot(long jobId, String url, Integer imageWidth) throws Exc driver.manage().window().setSize(new Dimension(width, height)); Thread.sleep(2000); - return ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); + File tempImage = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); + File tempDir = new File(fileUtils.fileBasePath + Consts.DIR_TEMPL + DateUtils.getNowDateYYYYMMDD()); + if (!tempDir.exists()) { + tempDir.mkdirs(); + } + File image = new File(tempDir.getPath() + File.separator + tempImage.getName()); + if (FileUtils.copy(tempImage, image) > -1) { + tempImage.delete(); + return image; + } } catch (TimeoutException te) { String text= driver.findElements(By.tagName("html")).get(0).getAttribute("innerText"); - scheduleLogger.info("TEXT: \n{}",text); + scheduleLogger.info("Cronjob({}) do screenshot url={} text=\n{}",text); LogEntries logEntries= driver.manage().logs().get(LogType.BROWSER); for (LogEntry entry : logEntries) { scheduleLogger.info(entry.getLevel() + " " + entry.getMessage()); @@ -163,7 +179,7 @@ private File doScreenshot(long jobId, String url, Integer imageWidth) throws Exc } scheduleLogger.error(e.getMessage(), e); } finally { - scheduleLogger.info("Cronjob({}) do screenshot for url({}) finish", jobId, url); + scheduleLogger.info("Cronjob({}) do screenshot url={} finish", jobId, url); driver.quit(); } @@ -195,13 +211,12 @@ private WebDriver generateWebDriver(Long jobId, Integer imageWidth) throws Execu private WebDriver generateChromeDriver() throws ExecutionException { - if(!StringUtils.isEmpty(REMOTE_WEBDRIVER_URL)){ - scheduleLogger.info("user RemoteWebDriver ({})",REMOTE_WEBDRIVER_URL); + if (!StringUtils.isEmpty(REMOTE_WEBDRIVER_URL)) { + scheduleLogger.info("user RemoteWebDriver ({})", REMOTE_WEBDRIVER_URL); try { - WebDriver driver = new RemoteWebDriver(new URL(REMOTE_WEBDRIVER_URL), DesiredCapabilities.chrome()); - return driver; - }catch (MalformedURLException ex){ - scheduleLogger.error(ex.getMessage(),ex); + return new RemoteWebDriver(new URL(REMOTE_WEBDRIVER_URL), DesiredCapabilities.chrome()); + } catch (MalformedURLException ex) { + scheduleLogger.error(ex.toString(), ex); } } File file = new File(CHROME_DRIVER_PATH); diff --git a/server/src/main/resources/application.yml b/server/src/main/resources/application.yml index 5b2e3d6fa..63251f6ce 100644 --- a/server/src/main/resources/application.yml +++ b/server/src/main/resources/application.yml @@ -36,25 +36,12 @@ spring: additional-location: file:${DAVINCI3_HOME}/config/ name: application - datasource: - type: com.alibaba.druid.pool.DruidDataSource - time-between-eviction-runs-millis: 30000 - min-evictable-idle-time-millis: 300000 - test-while-idle: true - test-on-borrow: false - test-on-return: false - filters: stat - break-after-acquire-failure: true - connection-error-retry-attempts: 3 - validation-query: SELECT 1 - resources: static-locations: classpath:/META-INF/resources/, classpath:/resources/, classpath:/static/, file:${file.userfiles-path}, file:${file.web_resources} mvc: static-path-pattern: /** - thymeleaf: mode: HTML5 cache: true