]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.core/src/main/java/org/argeo/slc/core/process/WebServiceSlcExecutionNotifier.java
Updates required by deploy
[gpl/argeo-slc.git] / org.argeo.slc.core / src / main / java / org / argeo / slc / core / process / WebServiceSlcExecutionNotifier.java
index 4befbe6a20d52db7c48831c692ec453780ef9927..9692344877fde1bdbecc46ce750bc858464acf53 100644 (file)
@@ -2,6 +2,7 @@ package org.argeo.slc.core.process;
 \r
 import java.util.List;\r
 \r
+import org.springframework.ws.client.WebServiceIOException;\r
 import org.springframework.ws.client.core.WebServiceTemplate;\r
 import org.springframework.ws.soap.client.SoapFaultClientException;\r
 \r
@@ -18,7 +19,12 @@ public class WebServiceSlcExecutionNotifier implements SlcExecutionNotifier {
 \r
        private Log log = LogFactory.getLog(getClass());\r
 \r
+       private Boolean cannotConnect = false;\r
+\r
        public void newExecution(SlcExecution slcExecution) {\r
+               if (cannotConnect)\r
+                       return;\r
+\r
                SlcExecutionRequest req = new SlcExecutionRequest();\r
                req.setSlcExecution(slcExecution);\r
                try {\r
@@ -28,10 +34,15 @@ public class WebServiceSlcExecutionNotifier implements SlcExecutionNotifier {
                                                + slcExecution.getUuid());\r
                } catch (SoapFaultClientException e) {\r
                        WebServiceUtils.manageSoapException(e);\r
+               } catch (WebServiceIOException e) {\r
+                       manageIoException(e);\r
                }\r
        }\r
 \r
        public void updateExecution(SlcExecution slcExecution) {\r
+               if (cannotConnect)\r
+                       return;\r
+\r
                SlcExecutionRequest req = new SlcExecutionRequest();\r
                req.setSlcExecution(slcExecution);\r
                try {\r
@@ -41,11 +52,16 @@ public class WebServiceSlcExecutionNotifier implements SlcExecutionNotifier {
                                                + slcExecution.getUuid());\r
                } catch (SoapFaultClientException e) {\r
                        WebServiceUtils.manageSoapException(e);\r
+               } catch (WebServiceIOException e) {\r
+                       manageIoException(e);\r
                }\r
        }\r
 \r
        public void updateStatus(SlcExecution slcExecution, String oldStatus,\r
                        String newStatus) {\r
+               if (cannotConnect)\r
+                       return;\r
+\r
                SlcExecutionStatusRequest req = new SlcExecutionStatusRequest(\r
                                slcExecution.getUuid(), newStatus);\r
                try {\r
@@ -55,11 +71,16 @@ public class WebServiceSlcExecutionNotifier implements SlcExecutionNotifier {
                                                + slcExecution.getUuid());\r
                } catch (SoapFaultClientException e) {\r
                        WebServiceUtils.manageSoapException(e);\r
+               } catch (WebServiceIOException e) {\r
+                       manageIoException(e);\r
                }\r
        }\r
 \r
        public void addSteps(SlcExecution slcExecution,\r
                        List<SlcExecutionStep> additionalSteps) {\r
+               if (cannotConnect)\r
+                       return;\r
+\r
                SlcExecutionStepsRequest req = new SlcExecutionStepsRequest();\r
                req.setSlcExecutionUuid(slcExecution.getUuid());\r
                req.setSteps(additionalSteps);\r
@@ -76,6 +97,8 @@ public class WebServiceSlcExecutionNotifier implements SlcExecutionNotifier {
                                                + slcExecution.getUuid());\r
                } catch (SoapFaultClientException e) {\r
                        WebServiceUtils.manageSoapException(e);\r
+               } catch (WebServiceIOException e) {\r
+                       manageIoException(e);\r
                }\r
        }\r
 \r
@@ -83,4 +106,12 @@ public class WebServiceSlcExecutionNotifier implements SlcExecutionNotifier {
                this.template = template;\r
        }\r
 \r
+       protected void manageIoException(WebServiceIOException e) {\r
+               if (!cannotConnect) {\r
+                       log.error("Cannot connect to " + template.getDefaultUri()\r
+                                       + ". Won't try again.", e);\r
+                       cannotConnect = true;\r
+               }\r
+       }\r
+\r
 }\r