Application.java
1005 Bytes
package com.viontech;
import com.viontech.model.KeepAlive;
import com.viontech.netty.ChannelGroup;
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());
}
}