ServiceCallThread.java [tools/GetClimateWindSoil/src/getclimatewindsoil] Revision: af24fed480b2b8d52b03aa714e30b7a762e256e0 Date: Tue Dec 03 15:27:33 MST 2019
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package getclimatewindsoil;
import csip.ServiceException;
import java.util.concurrent.CountDownLatch;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author <a href="mailto:shaun.case@colostate.edu">Shaun Case</a>
*/
public class ServiceCallThread extends Thread {
protected double latitude = Double.NaN, longitude = Double.NaN;
protected String coordinates = null;
protected CountDownLatch latch;
public ServiceCallThread(double latitude, double longitude, CountDownLatch latch) {
this.latitude = latitude;
this.longitude = longitude;
this.latch = latch;
}
public ServiceCallThread(String _coordinates, CountDownLatch latch) {
coordinates = _coordinates;
this.latch = latch;
}
@Override
public void run() {
CliWindSoil serviceCall = ((!Double.isNaN(latitude) && !Double.isNaN(longitude))
? new CliWindSoil(latitude, longitude, "http://csip.engr.colostate.edu:8092/csip-crp/m/cliwindsoil/1.0")
: new CliWindSoil(coordinates, "http://csip.engr.colostate.edu:8092/csip-crp/m/cliwindsoil/1.0"));
try {
serviceCall.call();
} catch (ServiceException ex) {
Logger.getLogger(ServiceCallThread.class.getName()).log(Level.SEVERE, null, ex);
}
latch.countDown();
}
}