X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.core%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Fprocess%2FWebServiceSlcExecutionNotifier.java;h=9692344877fde1bdbecc46ce750bc858464acf53;hb=fb1f473a0fa4f3b11ebbf7a676983ea946fbdac0;hp=4befbe6a20d52db7c48831c692ec453780ef9927;hpb=545cec1ea41db57c8e00f1b1a239fada86e0358f;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.core/src/main/java/org/argeo/slc/core/process/WebServiceSlcExecutionNotifier.java b/org.argeo.slc.core/src/main/java/org/argeo/slc/core/process/WebServiceSlcExecutionNotifier.java index 4befbe6a2..969234487 100644 --- a/org.argeo.slc.core/src/main/java/org/argeo/slc/core/process/WebServiceSlcExecutionNotifier.java +++ b/org.argeo.slc.core/src/main/java/org/argeo/slc/core/process/WebServiceSlcExecutionNotifier.java @@ -2,6 +2,7 @@ package org.argeo.slc.core.process; import java.util.List; +import org.springframework.ws.client.WebServiceIOException; import org.springframework.ws.client.core.WebServiceTemplate; import org.springframework.ws.soap.client.SoapFaultClientException; @@ -18,7 +19,12 @@ public class WebServiceSlcExecutionNotifier implements SlcExecutionNotifier { private Log log = LogFactory.getLog(getClass()); + private Boolean cannotConnect = false; + public void newExecution(SlcExecution slcExecution) { + if (cannotConnect) + return; + SlcExecutionRequest req = new SlcExecutionRequest(); req.setSlcExecution(slcExecution); try { @@ -28,10 +34,15 @@ public class WebServiceSlcExecutionNotifier implements SlcExecutionNotifier { + slcExecution.getUuid()); } catch (SoapFaultClientException e) { WebServiceUtils.manageSoapException(e); + } catch (WebServiceIOException e) { + manageIoException(e); } } public void updateExecution(SlcExecution slcExecution) { + if (cannotConnect) + return; + SlcExecutionRequest req = new SlcExecutionRequest(); req.setSlcExecution(slcExecution); try { @@ -41,11 +52,16 @@ public class WebServiceSlcExecutionNotifier implements SlcExecutionNotifier { + slcExecution.getUuid()); } catch (SoapFaultClientException e) { WebServiceUtils.manageSoapException(e); + } catch (WebServiceIOException e) { + manageIoException(e); } } public void updateStatus(SlcExecution slcExecution, String oldStatus, String newStatus) { + if (cannotConnect) + return; + SlcExecutionStatusRequest req = new SlcExecutionStatusRequest( slcExecution.getUuid(), newStatus); try { @@ -55,11 +71,16 @@ public class WebServiceSlcExecutionNotifier implements SlcExecutionNotifier { + slcExecution.getUuid()); } catch (SoapFaultClientException e) { WebServiceUtils.manageSoapException(e); + } catch (WebServiceIOException e) { + manageIoException(e); } } public void addSteps(SlcExecution slcExecution, List additionalSteps) { + if (cannotConnect) + return; + SlcExecutionStepsRequest req = new SlcExecutionStepsRequest(); req.setSlcExecutionUuid(slcExecution.getUuid()); req.setSteps(additionalSteps); @@ -76,6 +97,8 @@ public class WebServiceSlcExecutionNotifier implements SlcExecutionNotifier { + slcExecution.getUuid()); } catch (SoapFaultClientException e) { WebServiceUtils.manageSoapException(e); + } catch (WebServiceIOException e) { + manageIoException(e); } } @@ -83,4 +106,12 @@ public class WebServiceSlcExecutionNotifier implements SlcExecutionNotifier { this.template = template; } + protected void manageIoException(WebServiceIOException e) { + if (!cannotConnect) { + log.error("Cannot connect to " + template.getDefaultUri() + + ". Won't try again.", e); + cannotConnect = true; + } + } + }