@ GET @ Path ( "/launchProbe" ) @ Produces ( "application/txt" ) public String launchProbe ( ) throws IOException , UnsupportedPayloadType , ProbeSenderException , TransportException { Properties clientProps = getPropeSenderProps ( ) ; String multicastGroupAddr = clientProps . getProperty ( "multicastGroupAddr" , DEFAULT_MULTICAST_GROUP_ADDR ) ; String multicastPortString = clientProps . getProperty ( "multicastPort" , DEFAULT_MULTICAST_PORT . toString ( ) ) ; // String listenerIPAddress = clientProps.getProperty("listenerIPAddress"); // String listenerPort = clientProps.getProperty("listenerPort"); String listenerURLPath = clientProps . getProperty ( "listenerProbeResponseURLPath" , DEFAULT_PROBE_RESPONSE_URL_PATH ) ; Integer multicastPort = Integer . parseInt ( multicastPortString ) ; ProbeSender gen ; try { gen = ProbeSenderFactory . createMulticastProbeSender ( multicastGroupAddr , multicastPort ) ; // loop over the "respond to addresses" specified in the properties file. // TODO: Clean out the commented out code. // for (ProbeRespondToAddress rta : respondToAddresses) { // // Probe probe = new Probe(Probe.JSON); // probe.addRespondToURL("http://"+rta.respondToAddress+":"+rta.respondToPort+listenerURLPath); // // The following is a "naked" probe - no service contract IDs, etc. // // No specified service contract IDs implies "all" // // This will evoke responses from all reachable responders except those // configured to "noBrowser" // gen.sendProbe(probe); // } Probe probe = new Probe ( Probe . JSON ) ; for ( ProbeRespondToAddress rta : respondToAddresses ) { probe . addRespondToURL ( "browser" , "http://" + rta . respondToAddress + ":" + rta . respondToPort + listenerURLPath ) ; } // The following is a "naked" probe - no service contract IDs, etc. // No specified service contract IDs implies "all" // This will evoke responses from all reachable responders except those // configured to "noBrowser" gen . sendProbe ( probe ) ; gen . close ( ) ; return "Launched " + respondToAddresses . size ( ) + " probe(s) successfully on " + multicastGroupAddr + ":" + multicastPort ; } catch ( TransportConfigException e ) { return "Launched Failed: " + e . getLocalizedMessage ( ) ; } }
Actually launch a probe .