Application.java 1.12 KB
package com.viontech;

import com.viontech.model.KeepAlive;
import com.viontech.netty.ChannelGroup;
import com.viontech.utils.VideoUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@SpringBootApplication(exclude = org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration.class)
@Slf4j
@EnableScheduling
public class Application {
    public final static long REAL_TIME = 0x00000001L;
    public final static long NOT_REAL_TIME = 0x00000002L;


    public static void main(String[] args) {
        try {
            SpringApplication.run(Application.class, args);
        } catch (Exception e) {
            log.error("error", e);
        }
    }

    @Scheduled(fixedRate = 5000L, initialDelay = 5000L)
    public void keepAlive() {
        ChannelGroup.broadcast(new KeepAlive());
    }

    @Scheduled(fixedRate = 1000 * 60 * 10)
    public void cleanVideo() {
        VideoUtil.clean();
    }
}