Repository: odpi/egeria-connector-ibm-information-server
Issue: Need better connection retry logic

Currently seems that pretty much any failure to connect to IGC via the REST API results in a retry _by opening a new session_.  Should be more intelligent and see if the error is to do with a session timeout before blindly retrying new sessions, or we needlessly risk session overflows.

Changed files:
ia-clientlibrary/src/main/java/org/odpi/egeria/connectors/ibm/ia/clientlibrary/IARestClient.java
igc-clientlibrary/src/main/java/org/odpi/egeria/connectors/ibm/igc/clientlibrary/IGCRestClient.java

diff --git a/ia-clientlibrary/src/main/java/org/odpi/egeria/connectors/ibm/ia/clientlibrary/IARestClient.java b/ia-clientlibrary/src/main/java/org/odpi/egeria/connectors/ibm/ia/clientlibrary/IARestClient.java
index 1a3dad9b..d42bfaa7 100644
--- a/ia-clientlibrary/src/main/java/org/odpi/egeria/connectors/ibm/ia/clientlibrary/IARestClient.java
+++ b/ia-clientlibrary/src/main/java/org/odpi/egeria/connectors/ibm/ia/clientlibrary/IARestClient.java
@@ -275,7 +275,7 @@ public class IARestClient {
                     toSend,
                     String.class);
             setCookiesFromResponse(response);
-        } catch (HttpClientErrorException e) {
+        } catch (HttpClientErrorException.Forbidden e) {
             log.warn("Request failed -- session may have expired, retrying...", e);
             // If the response was forbidden (fails with exception), the session may have expired -- create a new one
             response = openNewSessionWithRequest(
diff --git a/igc-clientlibrary/src/main/java/org/odpi/egeria/connectors/ibm/igc/clientlibrary/IGCRestClient.java b/igc-clientlibrary/src/main/java/org/odpi/egeria/connectors/ibm/igc/clientlibrary/IGCRestClient.java
index 92954df3..b781375a 100644
--- a/igc-clientlibrary/src/main/java/org/odpi/egeria/connectors/ibm/igc/clientlibrary/IGCRestClient.java
+++ b/igc-clientlibrary/src/main/java/org/odpi/egeria/connectors/ibm/igc/clientlibrary/IGCRestClient.java
@@ -30,7 +30,6 @@ import org.odpi.egeria.connectors.ibm.igc.clientlibrary.model.types.TypeProperty
 import org.odpi.egeria.connectors.ibm.igc.clientlibrary.search.IGCSearch;
 import org.odpi.egeria.connectors.ibm.igc.clientlibrary.search.IGCSearchCondition;
 import org.odpi.egeria.connectors.ibm.igc.clientlibrary.search.IGCSearchConditionSet;
-import org.odpi.egeria.connectors.ibm.igc.clientlibrary.search.IGCSearchSorting;
 import org.odpi.egeria.connectors.ibm.igc.clientlibrary.update.IGCCreate;
 import org.odpi.egeria.connectors.ibm.igc.clientlibrary.update.IGCUpdate;
 import org.slf4j.Logger;
@@ -471,7 +470,7 @@ public class IGCRestClient {
                     toSend,
                     String.class
             );
-        } catch (HttpClientErrorException e) {
+        } catch (HttpClientErrorException.Forbidden e) {
             log.warn("Request failed -- session may have expired, retrying...", e);
             // If the response was forbidden (fails with exception), the session may have expired -- create a new one
             response = openNewSessionWithUpload(
@@ -534,7 +533,7 @@ public class IGCRestClient {
                     toSend,
                     String.class);
             setCookiesFromResponse(response);
-        } catch (HttpClientErrorException e) {
+        } catch (HttpClientErrorException.Forbidden e) {
             log.warn("Request failed -- session may have expired, retrying...", e);
             // If the response was forbidden (fails with exception), the session may have expired -- create a new one
             response = openNewSessionWithRequest(