1、监测数据缓存队列 增加容量限制,防止内存溢出
This commit is contained in:
@@ -505,7 +505,10 @@ public class Common {
|
||||
if(Constants.DEBUG_COMMON_ADDDETEDATA) {
|
||||
logger.debug(new String(dsb));
|
||||
}
|
||||
DETE_DATA_QUEUE.add(dsb);
|
||||
boolean add = DETE_DATA_QUEUE.add(dsb);
|
||||
if(!add) {
|
||||
logger.warn("监测数据添加失败");
|
||||
}
|
||||
}
|
||||
|
||||
//无监测数据列表增加删除的同步操作
|
||||
@@ -2867,8 +2870,9 @@ public class Common {
|
||||
|
||||
/**
|
||||
* 2018年7月30日 修改监测数据存放位置,改为保存到队列 中
|
||||
* 2019年4月2日14:30:19 初始化默认大小 20000
|
||||
*/
|
||||
private static final LinkedBlockingDeque<byte[]> DETE_DATA_QUEUE = new LinkedBlockingDeque<byte[]>();
|
||||
private static final LinkedBlockingDeque<byte[]> DETE_DATA_QUEUE = new LinkedBlockingDeque<byte[]>(Constants.DETE_DATA_QUEUE_CAPACITY);
|
||||
|
||||
/**
|
||||
* 保存监测数据到缓存队列
|
||||
|
||||
@@ -498,6 +498,11 @@ public class Constants {
|
||||
*/
|
||||
public static final boolean PORT_ZERO_WARNING_FLAG;
|
||||
|
||||
/**
|
||||
* 监测数据队列最大容量,防止nc长时间连接不上儿造成的dc短时间接收大量监测数据
|
||||
*/
|
||||
public static final Integer DETE_DATA_QUEUE_CAPACITY;
|
||||
|
||||
static {
|
||||
|
||||
// InetAddress inetAddress = null;
|
||||
@@ -884,6 +889,10 @@ public class Constants {
|
||||
|
||||
// 端口流量为 0 告警 功能
|
||||
PORT_ZERO_WARNING_FLAG = Config.getBoolan("port.zero.warning.flag", false);
|
||||
|
||||
//监测数据缓存队列容量
|
||||
DETE_DATA_QUEUE_CAPACITY = Config.getInteger("dete.data.queue.capacity", 20000);
|
||||
|
||||
}
|
||||
|
||||
//文件传输 临时文件命名后缀
|
||||
|
||||
Reference in New Issue
Block a user