aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLee, Tian (tl5884) <TianL@amdocs.com>2019-03-11 16:12:20 +0000
committerLee, Tian (tl5884) <TianL@amdocs.com>2019-03-11 16:12:20 +0000
commit23c3cdd1ebfbb5fd41a60c473dc3332ab16d6418 (patch)
treebe811e70ef65f723984ec5a8e4e772bcf8435533
parent366882beea302952ec27072251354c44b4a02bff (diff)
Fix Gizmo Sonar bugs
Change-Id: I8d74270fcf947222f3836ee2821a7bb921f2fff7 Issue-ID: AAI-2231 Signed-off-by: Lee, Tian (tl5884) <TianL@amdocs.com>
-rw-r--r--src/main/java/org/onap/crud/service/CrudAsyncGraphDataService.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/org/onap/crud/service/CrudAsyncGraphDataService.java b/src/main/java/org/onap/crud/service/CrudAsyncGraphDataService.java
index 7906de0..71efe35 100644
--- a/src/main/java/org/onap/crud/service/CrudAsyncGraphDataService.java
+++ b/src/main/java/org/onap/crud/service/CrudAsyncGraphDataService.java
@@ -20,6 +20,7 @@
*/
package org.onap.crud.service;
+import com.google.gson.JsonElement;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
@@ -68,8 +69,6 @@ import org.onap.crud.util.etag.EtagGenerator;
import org.onap.schema.OxmModelValidator;
import org.onap.schema.RelationshipSchemaValidator;
-import com.google.gson.JsonElement;
-
public class CrudAsyncGraphDataService extends AbstractGraphDataService {
private static Integer requestTimeOut;
@@ -149,6 +148,8 @@ public class CrudAsyncGraphDataService extends AbstractGraphDataService {
latch.await(CrudAsyncGraphDataService.getRequestTimeOut(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
latch.countDown();
+ // Restore interrupted state...
+ Thread.currentThread().interrupt();
if (this.graphEventEnvelope != null) {
return this.graphEventEnvelope;
} else {
@@ -203,6 +204,10 @@ public class CrudAsyncGraphDataService extends AbstractGraphDataService {
logger.error(CrudServiceMsgs.ASYNC_DATA_SERVICE_ERROR,
"Request timed out for transactionId: " + event.getTransactionId());
future.cancel(true);
+ if (e instanceof InterruptedException) {
+ // Restore interrupted state...
+ Thread.currentThread().interrupt();
+ }
throw new CrudException("Timed out , transactionId: " + event.getTransactionId() + " , operation: "
+ event.getOperation().toString(), Status.INTERNAL_SERVER_ERROR);
} finally {