StatsPersistTick singleton enum implementation

This commit is contained in:
Sergey Matvienko 2024-06-10 20:41:06 +02:00
parent 2c2273d15b
commit f96d9c377a
2 changed files with 4 additions and 2 deletions

View File

@ -78,7 +78,7 @@ public abstract class ComponentMsgProcessor<T extends EntityId> extends Abstract
}
public void scheduleStatsPersistTick(TbActorCtx context, long statsPersistFrequency) {
schedulePeriodicMsgWithDelay(context, new StatsPersistTick(), statsPersistFrequency, statsPersistFrequency);
schedulePeriodicMsgWithDelay(context, StatsPersistTick.INSTANCE, statsPersistFrequency, statsPersistFrequency);
}
protected boolean checkMsgValid(TbMsg tbMsg) {

View File

@ -18,7 +18,9 @@ package org.thingsboard.server.actors.stats;
import org.thingsboard.server.common.msg.MsgType;
import org.thingsboard.server.common.msg.TbActorMsg;
public final class StatsPersistTick implements TbActorMsg {
public enum StatsPersistTick implements TbActorMsg {
INSTANCE;
@Override
public MsgType getMsgType() {
return MsgType.STATS_PERSIST_TICK_MSG;