|
|
|
@ -83,8 +83,6 @@ public class IotDevicePowerOnAndOffDataJob { |
|
|
|
return requestConfigBuilder; |
|
|
|
})); |
|
|
|
|
|
|
|
private static final ReentrantLock lock = new ReentrantLock(true); |
|
|
|
|
|
|
|
/** |
|
|
|
* 当前索引日期后缀 |
|
|
|
*/ |
|
|
|
@ -118,7 +116,7 @@ public class IotDevicePowerOnAndOffDataJob { |
|
|
|
@Override |
|
|
|
public void open(Configuration parameters) { |
|
|
|
|
|
|
|
StateTtlConfig ttlConfig = StateTtlConfig.newBuilder(Time.hours(1)) |
|
|
|
StateTtlConfig ttlConfig = StateTtlConfig.newBuilder(Time.minutes(10)) |
|
|
|
.setUpdateType(StateTtlConfig.UpdateType.OnCreateAndWrite) |
|
|
|
.setStateVisibility(StateTtlConfig.StateVisibility.NeverReturnExpired) |
|
|
|
.build(); |
|
|
|
@ -331,7 +329,6 @@ public class IotDevicePowerOnAndOffDataJob { |
|
|
|
GetIndexRequest exist = new GetIndexRequest(indicesName); |
|
|
|
// 先判断客户端是否存在 |
|
|
|
try { |
|
|
|
lock.lock(); |
|
|
|
boolean exists = restHighLevelClient.indices().exists(exist, RequestOptions.DEFAULT); |
|
|
|
if (!exists) { |
|
|
|
// 创建索引 |
|
|
|
@ -391,8 +388,6 @@ public class IotDevicePowerOnAndOffDataJob { |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
}finally { |
|
|
|
lock.unlock(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |