Skip to content

Commit

Permalink
check if connected
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvaroVega committed Sep 27, 2024
1 parent 1162cee commit 8058d6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.net.SocketException;

import com.telefonica.iot.cygnus.backends.arcgis.exceptions.ArcgisException;
import com.telefonica.iot.cygnus.backends.arcgis.model.Credential;
Expand Down Expand Up @@ -593,6 +594,9 @@ private void setError(Exception e) {
this.errorCode = agsEx.getCode();
} else {
if (e != null && e.getCause() != null) {
if (e.getCause() instanceof SocketException) {
connected = false;
}
LOGGER.error("Error Cause: " + e.getCause().getMessage());
}
LOGGER.error("Error Message: " + e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ protected int featuresBatched() {
*/
protected ArcgisFeatureTable getPersistenceBackend(String featureServiceUrl) throws CygnusRuntimeError {

if (arcgisPersistenceBackend.containsKey(featureServiceUrl)) {
if (arcgisPersistenceBackend.containsKey(featureServiceUrl) &&
arcgisPersistenceBackend.get(featureServiceUrl).connected() ){
LOGGER.debug("Using persistenceBackend which contains key for Feature table: " + featureServiceUrl);
return arcgisPersistenceBackend.get(featureServiceUrl);
} else {
Expand Down

0 comments on commit 8058d6e

Please sign in to comment.