improved return values ...

This commit is contained in:
2014-05-06 16:14:21 +02:00
parent 3ce7282214
commit 57ecb121b2

View File

@@ -33,6 +33,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import javax.inject.Inject;
import javax.ws.rs.WebApplicationException;
import ch.psi.fda.edescriptor.EDescriptor;
import ch.psi.jcae.ChannelService;
@@ -100,19 +101,23 @@ public class ExecutionEngine {
logger.info("Terminate TrackingId: "+trackingId);
if(!erequests.containsKey(trackingId)){
throw new IllegalArgumentException("There is no request for tracking id "+trackingId);
throw new WebApplicationException("There is no request for tracking id "+trackingId, 404);
}
final JobEntry f = erequests.get(trackingId);
f.getFuture().cancel(true);
f.getJob().stop();
try{
f.getFuture().get(10, TimeUnit.SECONDS);
}
catch(CancellationException | InterruptedException | ExecutionException | TimeoutException e){
// Nothing to be done here
throw new WebApplicationException("Unable to terminate job");
}
erequests.remove(trackingId);
}
public boolean isActive(String trackingId) {