
com.ebay.jetstream.event.processor.loadbalance.PartionedLoadBalancerConfig Maven / Gradle / Ivy
/*******************************************************************************
* Copyright © 2012-2015 eBay Software Foundation
* This program is dual licensed under the MIT and Apache 2.0 licenses.
* Please see LICENSE for more information.
*******************************************************************************/
package com.ebay.jetstream.event.processor.loadbalance;
/**
*
* Configuration holder class for PartitionedLoadBalancer
*
* Sample Spring XML syntax
*
*
*
* @author [email protected]
*
*/
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import com.ebay.jetstream.config.AbstractNamedBean;
import com.ebay.jetstream.xmlser.XSerializable;
public class PartionedLoadBalancerConfig extends AbstractNamedBean implements XSerializable {
private Map> m_partitionKeys = new ConcurrentHashMap>();
public PartionedLoadBalancerConfig() {}
public Map> getPartitionKeys() {
return Collections.unmodifiableMap(m_partitionKeys);
}
public List getPartitionFields(String eventType) {
return m_partitionKeys.get(eventType);
}
public void setPartitionKeys(Map> partitionKeys) {
Set>> partKeySet = partitionKeys.entrySet();
Iterator>> itr = partKeySet.iterator();
m_partitionKeys.clear();
while(itr.hasNext()) {
Entry> entry = itr.next();
List fieldList = new CopyOnWriteArrayList();
fieldList.addAll(entry.getValue());
m_partitionKeys.put(entry.getKey(), fieldList);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy