private List < Probe > splitProbe ( Probe probe ) throws ProbeSenderException , JAXBException , MalformedURLException , UnsupportedPayloadType { List < Probe > actualProbeList = new ArrayList < Probe > ( ) ; int maxPayloadSize = this . probeTransport . maxPayloadSize ( ) ; LinkedList < ProbeIdEntry > combinedList = probe . getCombinedIdentifierList ( ) ; // use a strategy to split up the probe into biggest possible chunks // all respondTo address must be included - if that's a problem then throw // an exception - the user will need to do some thinking. // start by taking one siid or scid off put it into a temp probe, check the // payload size of the probe and repeat until target probe is right size. // put the target probe in the list, make the temp probe the target probe // and start the process again. // Not sure how to do this with wireline compression involved. if ( probe . asXML ( ) . length ( ) < maxPayloadSize ) { actualProbeList . add ( probe ) ; } else { Probe frame = Probe . frameProbeFrom ( probe ) ; Probe splitProbe = new Probe ( frame ) ; int payloadLength = splitProbe . asXML ( ) . length ( ) ; ProbeIdEntry nextId = combinedList . peek ( ) ; if ( payloadLength + nextId . getId ( ) . length ( ) + 40 >= maxPayloadSize ) { throw new ProbeSenderException ( "Basic frame violates maxPayloadSize of transport. Likely due to too many respondTo address." ) ; } while ( ! combinedList . isEmpty ( ) ) { payloadLength = splitProbe . asXML ( ) . length ( ) ; nextId = combinedList . peek ( ) ; if ( payloadLength + nextId . getId ( ) . length ( ) + 40 >= maxPayloadSize ) { actualProbeList . add ( splitProbe ) ; splitProbe = new Probe ( frame ) ; } ProbeIdEntry id = combinedList . pop ( ) ; switch ( id . getType ( ) ) { case "scid" : splitProbe . addServiceContractID ( id . getId ( ) ) ; break ; case "siid" : splitProbe . addServiceInstanceID ( id . getId ( ) ) ; break ; default : break ; } } actualProbeList . add ( splitProbe ) ; } return actualProbeList ; }
This method will take the given probe to send and then chop it up into smaller probes that will fit under the maximum packet size specified by the transport . This is important because Argo wants the UDP packets to not get chopped up by the network routers of at all possible . This makes the overall reliability of the protocol a little higher .