1、druid连接池增加 maxwait 配置,默认10s

This commit is contained in:
fangshunjian
2018-11-08 15:38:33 +08:00
parent 74c3c0b303
commit ba43f4203d
3 changed files with 10 additions and 2 deletions

View File

@@ -475,6 +475,10 @@ public class Constants {
*/
public static final boolean FILE_DOWNLOAD_FROM_COMMUNICATE_WEB;
/**
* druid 连接池 获取连接最大等待时间
*/
public static final Long DRUID_MAXWAIT_MILLIS;
static {
// InetAddress inetAddress = null;
@@ -839,7 +843,10 @@ public class Constants {
* 任务 文件 下载 ip 获取方式true配置文件中的 web.socket.ip;false:system_table表中的 server_ip
*/
FILE_DOWNLOAD_FROM_COMMUNICATE_WEB = Config.getBoolan("file.download.from.communicate.web", true);
/*
* 默认值10s
*/
DRUID_MAXWAIT_MILLIS = Long.valueOf(Config.getString("druid.maxwait.millis", "10000"));
}
//文件传输 临时文件命名后缀

View File

@@ -57,7 +57,7 @@ public class FileUploadManagerThread implements Runnable{
dao = new CommonDao();
service = new UpgradeService(dao);
}
hostIp = service.getHostIpByMissionId(mid);
hostIp = Constants.FILE_DOWNLOAD_FROM_COMMUNICATE_WEB ? Constants.WEB_SOCKET_IP : service.getHostIpByMissionId(mid);
Common.addMissionIdWebIPMap(mid,hostIp);
}
}catch (NumberFormatException e) {

View File

@@ -39,6 +39,7 @@ public class DruidPool {
ds.setPassword(Constants.DB_PASSWORD);
ds.configFromPropety(properties);
ds.setName("Druid连接池");
ds.setMaxWait(Constants.DRUID_MAXWAIT_MILLIS);//最大等待时间
ds.init();
logger.debug("Druid初始化连接池成功,"+ds.toString());
}