예제 #1
0
  public void resendMessage(Message message, IP remoteAddress, int remotePort) throws IOException {
    if (remoteAddress == null) remoteAddress = IP.getLocalHost();

    message.setSentStamp(getConvertedTime(remoteAddress, remotePort));
    message.setMessageServer(this);
    try {
      sendBuffer.clear();
      sendBuffer.put(extractor.convertMessage(message));
      sendBuffer.flip();
      channel.send(sendBuffer, new InetSocketAddress(remoteAddress.toString(), remotePort));
      message.setRemoteAddress(remoteAddress);
      message.setRemotePort(remotePort);
      messageSent(message);
    } catch (IllegalAccessException exc) {
      throw new RuntimeException(exc);
    } catch (IllegalArgumentException exc) {
      throw new RuntimeException(exc);
    } catch (InvocationTargetException exc) {
      throw new RuntimeException(exc);
    }
  }
예제 #2
0
  public void sendMessage(Message message, IP remoteAddress, int remotePort) throws IOException {
    message.setId(JGN.getUniqueLong());

    if (message instanceof CertifiedMessage) {
      getMessageCertifier().enqueue((CertifiedMessage) message, remoteAddress, remotePort);
    }
    if (message instanceof OrderedMessage) {
      if (((OrderedMessage) message).getOrderId() == -1) {
        ((OrderedMessage) message)
            .setOrderId(OrderedMessage.createUniqueId(((OrderedMessage) message).getOrderGroup()));
      }
    }
    resendMessage(message, remoteAddress, remotePort);
  }