Пример #1
0
 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);
   }
 }
Пример #2
0
 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);
   }
 }
Пример #3
0
 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);
 }
Пример #4
0
 public static void onChannelClosed(JAsyncSocket channel) {
   IRtuSimulator simulator = (IRtuSimulator) channel.attachment();
   simulator.onClose(channel);
 }