1 <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>MessageChannelFactory.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">vfc-nfvo-driver-ems-ems-boco</a> > <a href="index.source.html" class="el_package">org.onap.vfc.nfvo.emsdriver.messagemgr</a> > <span class="el_source">MessageChannelFactory.java</span></div><h1>MessageChannelFactory.java</h1><pre class="source lang-java linenums">/**
2 * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.vfc.nfvo.emsdriver.messagemgr;
18 import java.util.HashMap;
21 <span class="nc" id="L21">public class MessageChannelFactory {</span>
23 <span class="fc" id="L23"> public static Map<String, MessageChannel> map = new HashMap<String, MessageChannel>();</span>
25 public synchronized static MessageChannel getMessageChannel(String key,Integer size){
26 <span class="pc bpc" id="L26" title="1 of 2 branches missed."> if(map.get(key) != null){</span>
27 <span class="nc" id="L27"> return map.get(key);</span>
29 <span class="fc" id="L29"> MessageChannel mc = null;</span>
30 <span class="pc bpc" id="L30" title="2 of 4 branches missed."> if(size != null && size > 0){</span>
31 <span class="fc" id="L31"> mc = new MessageChannel(size);</span>
33 <span class="nc" id="L33"> mc = new MessageChannel();</span>
36 <span class="fc" id="L36"> map.put(key, mc);</span>
37 <span class="fc" id="L37"> return mc;</span>
40 public synchronized static MessageChannel getMessageChannel(String key){
41 <span class="fc bfc" id="L41" title="All 2 branches covered."> if(map.get(key) != null){</span>
42 <span class="fc" id="L42"> return map.get(key);</span>
44 <span class="fc" id="L44"> MessageChannel mc = new MessageChannel();</span>
46 <span class="fc" id="L46"> map.put(key, mc);</span>
47 <span class="fc" id="L47"> return mc;</span>
50 public synchronized static boolean destroyMessageChannel(String key){
51 <span class="pc bpc" id="L51" title="1 of 2 branches missed."> if(map.get(key) != null){</span>
52 <span class="nc" id="L52"> map.remove(key);</span>
53 <span class="nc" id="L53"> return true;</span>
55 <span class="fc" id="L55"> return false;</span>
58 public synchronized static void clean(){
59 <span class="fc" id="L59"> map.clear();</span>
60 <span class="fc" id="L60"> }</span>
62 </pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.7.201606060606</span></div></body></html>