diff options
author | Lo, WEI-TING(wl849v) <wl849v@att.com> | 2018-05-29 17:00:44 -0400 |
---|---|---|
committer | Wei-Ting Lo <wl849v@att.com> | 2018-05-29 21:01:54 +0000 |
commit | 57fb6c21839434a6a8e7fe26e5774061c6fe6014 (patch) | |
tree | c1f7233226446ff407aa430d1862b4c9cf80d6b1 /ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf | |
parent | 4f1afd26403c688b29c8329be66dcaded951bd54 (diff) |
Music ver upgrade
Issue-ID: PORTAL-293
Music toggle enable
Change-Id: I72986134afaf533a086307f82d9f925db793423c
Signed-off-by: Lo, WEI-TING(wl849v) <wl849v@att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf')
-rw-r--r-- | ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java index 7d2e51ff..0e8551b9 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java @@ -55,40 +55,50 @@ public class MusicSessionRepositoryHandler { public Session get(String id) { - if(!musicCache){ + if(musicCache){ + // todo need to add the clean up for "sessions" map if musicCache is enabled + return this.sessions.get(id); + }else{ try { Session session = MusicService.getMetaAttribute(id); return session; } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "get failed with id " + id, e); + return null; } - } - return this.sessions.get(id); + } } public void remove(String id) { - sessions.remove(id); - try { - MusicService.removeSession(id); - } catch (MusicLockingException e) { - logger.error(EELFLoggerDelegate.errorLogger, "removeSession locking failed with id " + id, e); - } catch (MusicServiceException e) { - logger.error(EELFLoggerDelegate.errorLogger, "removeSession failed with id " + id, e); + if(musicCache){ + // todo need to add the clean up for "sessions" map if musicCache is enabled + sessions.remove(id); + }else{ + try { + MusicService.removeSession(id); + } catch (MusicLockingException e) { + logger.error(EELFLoggerDelegate.errorLogger, "removeSession locking failed with id " + id, e); + } catch (MusicServiceException e) { + logger.error(EELFLoggerDelegate.errorLogger, "removeSession failed with id " + id, e); + } } } public void put(String id, MusicSession musicSession) { - sessions.put(id, musicSession); - try { - MusicService.setMetaAttribute(musicSession); - MusicService.cleanUpMusic(); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "setMetaAttribute failed with id " + id, e); + if(musicCache){ + // todo need to add the clean up for "sessions" map if musicCache is enabled + sessions.put(id, musicSession); + }else{ + try { + MusicService.setMetaAttribute(musicSession); + MusicService.cleanUpMusic(); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "setMetaAttribute failed with id " + id, e); + } } } - } |