public static void onChannelReceive(JAsyncSocket channel, IMessage message) { IRtuSimulator simulator = (IRtuSimulator) channel.attachment(); simulator.onReceive(channel, message); synchronized (lockRecv) { totalRecv++; if (recvMsg.size() > 5000) recvMsg.removeFirst(); recvMsg.add(message); } }
public static void onChannelSend(JAsyncSocket channel, IMessage message) { IRtuSimulator simulator = (IRtuSimulator) channel.attachment(); simulator.onSend(channel, message); synchronized (lockSend) { totalSend++; if (sendMsg.size() > 5000) sendMsg.removeFirst(); sendMsg.add(message); } }
public static void onChannelConnected(JAsyncSocket channel) { IRtuSimulator simulator = (IRtuSimulator) channel.attachment(); if (0 == simulator.getRtua()) { synchronized (simulators) { simulator.setRtua(rtua++); simulators.add(simulator); } } simulator.onConnect(channel); }
public static void onChannelClosed(JAsyncSocket channel) { IRtuSimulator simulator = (IRtuSimulator) channel.attachment(); simulator.onClose(channel); }