重启终端置空
parent
00dd09801c
commit
b71224ed9b
@ -1,43 +0,0 @@
|
||||
package com.docus.server;
|
||||
|
||||
import com.docus.core.util.DateUtil;
|
||||
import com.docus.core.util.json.JSON;
|
||||
import com.docus.server.common.netty.CommMsg;
|
||||
import com.docus.server.common.netty.server.ChannelRepository;
|
||||
import com.docus.server.convert.CommMsgConvert;
|
||||
import com.docus.server.dto.scheduling.management.schterminator.CommMsgDTO;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.util.CharsetUtil;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
//@Configuration
|
||||
public class JobConfig {
|
||||
@Resource
|
||||
private ChannelRepository channelRepository;
|
||||
|
||||
// @Async("recordMessage")
|
||||
// @Scheduled(cron = "0/1 * * * * ?")
|
||||
public void runTask() throws InterruptedException {
|
||||
|
||||
Map<String, Channel> channelMap = channelRepository.getIpToChannelCacheMap();
|
||||
Set<String> keySet = channelMap.keySet();
|
||||
|
||||
for (String clientIp : keySet) {
|
||||
Channel channel = channelMap.get(clientIp);
|
||||
|
||||
CommMsg commMsg = CommMsgConvert.INSTANCE.convertDO(new CommMsgDTO());
|
||||
commMsg.setMessageTime(DateUtil.formatDateTime(new Date()));
|
||||
|
||||
if (channel != null) {
|
||||
channel.writeAndFlush(Unpooled.copiedBuffer(JSON.toJSON(commMsg), CharsetUtil.UTF_8));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue