summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Nelson <nelson24@att.com>2018-11-20 15:37:26 +0000
committerGerrit Code Review <gerrit@onap.org>2018-11-20 15:37:26 +0000
commitc6276aaaea6933c763fe767e5d0e23bd8ccb7bd1 (patch)
tree84fc7f52e33c83f9db2249b854bf8cf96aae52b9 /src
parentd35044fcb48aa09cbca5f6a89821e9cce5b0ba63 (diff)
parent458f4be403cea7ae9091cd4ba9bd432c2c941ed8 (diff)
Merge "Sonar Fix: MusicLockingService"
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/music/lockingservice/MusicLockingService.java27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/main/java/org/onap/music/lockingservice/MusicLockingService.java b/src/main/java/org/onap/music/lockingservice/MusicLockingService.java
index f9c09338..097055ba 100644
--- a/src/main/java/org/onap/music/lockingservice/MusicLockingService.java
+++ b/src/main/java/org/onap/music/lockingservice/MusicLockingService.java
@@ -52,30 +52,35 @@ public class MusicLockingService implements Watcher {
connectedSignal.await();
zkLockHandle = new ZkStatelessLockService(zk);
} catch (IOException e) {
+ logger.error("Error", e);
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.IOERROR, ErrorSeverity.ERROR, ErrorTypes.CONNECTIONERROR);
throw new MusicServiceException("IO Error has occured" + e.getMessage());
} catch (InterruptedException e) {
+ logger.error("Error", e);
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
throw new MusicServiceException("Exception Occured " + e.getMessage());
}
}
- public ZkStatelessLockService getzkLockHandle() {
- return zkLockHandle;
- }
-
public MusicLockingService(String lockServer) {
try {
ZooKeeper zk = new ZooKeeper(lockServer, SESSION_TIMEOUT, this);
connectedSignal.await();
zkLockHandle = new ZkStatelessLockService(zk);
} catch (IOException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.IOERROR, ErrorSeverity.ERROR, ErrorTypes.CONNECTIONERROR);
+ logger.error("Error", e);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.IOERROR, ErrorSeverity.ERROR, ErrorTypes.CONNECTIONERROR);
}catch( InterruptedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
- }catch(Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
- }
+ logger.error("Error", e);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ }catch(Exception e) {
+ logger.error("Error", e);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ }
+ }
+
+ public ZkStatelessLockService getzkLockHandle() {
+ return zkLockHandle;
}
public void createLockaIfItDoesNotExist(String lockName) {
@@ -98,6 +103,7 @@ public class MusicLockingService implements Watcher {
try{
data = zkLockHandle.getNodeData(lockName);
}catch (Exception ex){
+ logger.error("Error", ex);
logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}
if(data !=null)
@@ -120,10 +126,13 @@ public class MusicLockingService implements Watcher {
try {
return zkLockHandle.lock(lockName, lockId);
} catch (KeeperException e) {
+ logger.error("Error", e);
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.LOCKINGERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}catch( InterruptedException e) {
+ logger.error("Error", e);
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}catch(Exception e) {
+ logger.error("Error", e);
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}
return false;