Java Magazine, Jan/Feb 2018
ORACLE COM JAVAMAGAZINE JANUARY FEBRUARY 2018 24 reactive programming private WebTarget temperatureTarget @ GET @ Produces MediaType APPLICATION_ JSON public Response getLocationsWithTemperature long startTime System currentTimeMillis ServiceResponse response new ServiceResponse List Location locations locationTarget request get new GenericType List Location locations forEach location Temperature temperature temperatureTarget resolveTemplate city location getName request get Temperature class response getForecasts add new Forecast location setTemperature temperature long endTime System currentTimeMillis response setProcessingTime endTime startTime return Response ok response build When the forecast endpoint is requested as forecast you should see output similar to Listing 10 Notice that the processing time of the request took 1533 ms which makes sense because requesting temperature values for three diferent locations synchronously would add up to 1500 ms
You must have JavaScript enabled to view digital editions.