Advertisement
Aleksandr37rus

Untitled

Sep 13th, 2022
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.87 KB | None | 0 0
  1. void processTask(ChannelHandlerContext ctx) {
  2.         InetSocketAddress lineAddress = new InetSocketAddress(getIpAddress(), getUdpPort());  CommandType typeToRemove;
  3.         for (Command currentCommand : getAllCommands()) {
  4.             if (currentCommand.getCommandType() == CommandType.REBOOT_CHANNEL) {
  5.                 if (!currentCommand.isAttemptsNumberExhausted()) {
  6.                 if (currentCommand.isTimeToSend()) {
  7.                     sendCommandToContext(ctx, lineAddress, currentCommand.getCommandText());
  8.  
  9.                     try {
  10.                         AdminController.getInstance().processUssdMessage(
  11.                                 new DblIncomeUssdMessage(lineAddress.getHostName(), lineAddress.getPort(), 0,  EnumGoip.getByModel(getGoipModel()), currentCommand.getCommandText()), false);  } catch (Exception ignored) { }
  12.                     currentCommand.setSendDate(new Date());
  13.                     Log.ussd.write(String.format("sent: ip: %s; порт: %d; %s",
  14.                             lineAddress.getHostString(), lineAddress.getPort(), currentCommand.getCommandText()));  currentCommand.incSendCounter();
  15.                 }
  16.             } else {
  17.                 typeToRemove = currentCommand.getCommandType();
  18.                 deleteCommand(typeToRemove);
  19.             }
  20.             } else {
  21.                 if (!currentCommand.isAttemptsNumberExhausted()) {
  22.                     sendCommandToContext(ctx, lineAddress, currentCommand.getCommandText());
  23.  
  24.                     try {
  25.                         AdminController.getInstance().processUssdMessage(
  26.                                 new DblIncomeUssdMessage(lineAddress.getHostName(), lineAddress.getPort(), 0,  EnumGoip.getByModel(getGoipModel()), currentCommand.getCommandText()), false);  } catch (Exception ignored) { }
  27.                     Log.ussd.write(String.format("sent: ip: %s; порт: %d; %s",
  28.                             lineAddress.getHostString(), lineAddress.getPort(), currentCommand.getCommandText()));  currentCommand.setSendDate(new Date());
  29.                     currentCommand.incSendCounter();
  30.                 } else {
  31.                     typeToRemove = currentCommand.getCommandType();
  32.                     deleteCommand(typeToRemove);
  33.                 }
  34.             }
  35.         }
  36.         sendKeepAliveOkAndFlush(ctx);  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement