private DatagramPacket[] encodeMulticastRequest(final MulticastRequest req) throws IOException {
  final Discovery disco=getDiscovery(multicastRequestConstraints.chooseProtocolVersion());
  final List packets=new ArrayList();
  EncodeIterator ei=disco.encodeMulticastRequest(req,multicastRequestConstraints.getMulticastMaxPacketSize(DEFAULT_MAX_PACKET_SIZE),multicastRequestConstraints.getUnfulfilledConstraints());
  while (ei.hasNext()) {
    try {
      packets.addAll(Arrays.asList(ei.next()));
    }
 catch (    Exception e) {
      logger.log((e instanceof UnsupportedConstraintException) ? Levels.HANDLED : Level.INFO,"exception encoding multicast request",e);
    }
  }
  if (packets.isEmpty()) {
    throw new DiscoveryProtocolException("no encoded requests");
  }
  return (DatagramPacket[])packets.toArray(new DatagramPacket[packets.size()]);
}

private DatagramPacket [ ] encodeMulticastRequest ( final MulticastRequest req ) throws IOException { final Discovery disco = getDiscovery ( multicastRequestConstraints . chooseProtocolVersion ( ) ) ; final List packets = new ArrayList ( ) ; EncodeIterator ei = disco . encodeMulticastRequest ( req , multicastRequestConstraints . getMulticastMaxPacketSize ( DEFAULT_MAX_PACKET_SIZE ) , multicastRequestConstraints . getUnfulfilledConstraints ( ) ) ; while ( ei . hasNext ( ) ) { try { packets . addAll ( Arrays . asList ( ei . next ( ) ) ) ; } catch ( Exception e ) { logger . log ( ( e instanceof UnsupportedConstraintException ) ? Levels . HANDLED : Level . INFO , "exception encoding multicast request" , e ) ; } } if ( packets . isEmpty ( ) ) { throw new DiscoveryProtocolException ( "no encoded requests" ) ; } return ( DatagramPacket [ ] ) packets . toArray ( new DatagramPacket [ packets . size ( ) ] ) ; }
encodes outgoing multicast requests based on protocol in use , applying configured security constraints ( if any ) .
