2 * Copyright IBM Corporation, 2013. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.md.statistics.manager;
11 import java.util.concurrent.ConcurrentHashMap;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
16 * Main responsibility of the class is to manage multipart response
17 * for multipart request. It also handles the flow aggregate request
18 * and response mapping.
19 * @author avishnoi@in.ibm.com
22 public class MultipartMessageManager {
25 * Map for tx id and type of request, to keep track of all the request sent
26 * by Statistics Manager. Statistics Manager won't entertain any multipart
27 * response for which it didn't send the request.
30 private static Map<TransactionId,StatsRequestType> txIdToRequestTypeMap = new ConcurrentHashMap<TransactionId,StatsRequestType>();
32 * Map to keep track of the request tx id for flow table statistics request.
33 * Because flow table statistics multi part response do not contains the table id.
35 private static Map<TransactionId,Short> txIdTotableIdMap = new ConcurrentHashMap<TransactionId,Short>();
37 public MultipartMessageManager(){}
39 public Short getTableIdForTxId(TransactionId id){
41 return txIdTotableIdMap.get(id);
45 public void setTxIdAndTableIdMapEntry(TransactionId id,Short tableId){
46 txIdTotableIdMap.put(id, tableId);
49 public void addTxIdToRequestTypeEntry (TransactionId id,StatsRequestType type){
50 txIdToRequestTypeMap.put(id, type);
52 public StatsRequestType removeTxId(TransactionId id){
53 return txIdToRequestTypeMap.remove(id);
56 public enum StatsRequestType{