Fix handling of InterruptedException in AAI-Champ 21/56021/1
authorWiktor Garbarek <wiktor.garbarek@nokia.com>
Mon, 9 Jul 2018 13:18:19 +0000 (15:18 +0200)
committerWiktor Garbarek <wiktor.garbarek@nokia.com>
Mon, 9 Jul 2018 13:18:19 +0000 (15:18 +0200)
Added thread interrupts

Change-Id: Ic5b7eef71354efd02736e88a1e6716aa84169898
Issue-ID: AAI-1367
Signed-off-by: Wiktor Garbarek <wiktor.garbarek@nokia.com>
champ-lib/champ-core/src/main/java/org/onap/aai/champcore/event/AbstractLoggingChampGraph.java
champ-lib/champ-core/src/main/java/org/onap/aai/champcore/graph/impl/TinkerpopTransaction.java
champ-lib/champ-janus/src/main/java/org/onap/aai/champjanus/graph/impl/JanusChampGraphImpl.java
champ-lib/champ-titan/src/main/java/org/onap/aai/champtitan/graph/impl/TitanChampGraphImpl.java

index 1f93a97..d920dbc 100644 (file)
@@ -398,7 +398,10 @@ public abstract class AbstractLoggingChampGraph implements ChampGraph {
 
       try {
         publisherPool.awaitTermination(1000, TimeUnit.MILLISECONDS);
-      } catch (InterruptedException e) {}
+      } catch (InterruptedException e) {
+        logger.warn("Termination interrupted");
+        Thread.currentThread().interrupt();
+      }
     }
 
     if(producer != null) {
index f78abea..bd970dc 100644 (file)
@@ -108,7 +108,7 @@ public class TinkerpopTransaction extends ChampTransaction {
         } catch (InterruptedException ie) {
 
           LOGGER.info("Interrupted while backing off on transaction commit");
-          Thread.interrupted();
+          Thread.currentThread().interrupt();
           return;
         }
       }
@@ -153,7 +153,7 @@ public class TinkerpopTransaction extends ChampTransaction {
         } catch (InterruptedException ie) {
 
           LOGGER.info("Interrupted while backing off on transaction rollback");
-          Thread.interrupted();
+          Thread.currentThread().interrupt();
           return;
         }
       }
index 906c767..f78450c 100644 (file)
@@ -383,6 +383,7 @@ public final class JanusChampGraphImpl extends AbstractTinkerpopChampGraph {
       }
     } catch (InterruptedException e) {
       LOGGER.warn("Interrupted while waiting for object index creation status");
+      Thread.currentThread().interrupt();
       return;
     }
 
@@ -394,6 +395,7 @@ public final class JanusChampGraphImpl extends AbstractTinkerpopChampGraph {
       updateIndexMgmt.commit();
     } catch (InterruptedException e) {
       LOGGER.warn("Interrupted while reindexing for object index");
+      Thread.currentThread().interrupt();
       return;
     } catch (ExecutionException e) {
       LOGGER.warn("Exception occurred during reindexing procedure for creating object index " + indexName, e);
@@ -406,6 +408,7 @@ public final class JanusChampGraphImpl extends AbstractTinkerpopChampGraph {
           .call();
     } catch (InterruptedException e) {
       LOGGER.warn("Interrupted while waiting for index to transition to ENABLED state");
+      Thread.currentThread().interrupt();
       return;
     }
   }
index f3d821c..209bf79 100644 (file)
@@ -362,6 +362,7 @@ public final class TitanChampGraphImpl extends AbstractTinkerpopChampGraph {
       }
     } catch (InterruptedException e) {
       LOGGER.warn("Interrupted while waiting for object index creation status");
+      Thread.currentThread().interrupt();
       return;
     }
 
@@ -373,6 +374,7 @@ public final class TitanChampGraphImpl extends AbstractTinkerpopChampGraph {
       updateIndexMgmt.commit();
     } catch (InterruptedException e) {
       LOGGER.warn("Interrupted while reindexing for object index");
+      Thread.currentThread().interrupt();
       return;
     } catch (ExecutionException e) {
       LOGGER.warn("Exception occurred during reindexing procedure for creating object index " + indexName, e);
@@ -385,6 +387,7 @@ public final class TitanChampGraphImpl extends AbstractTinkerpopChampGraph {
           .call();
     } catch (InterruptedException e) {
       LOGGER.warn("Interrupted while waiting for index to transition to ENABLED state");
+      Thread.currentThread().interrupt();
       return;
     }
   }