本文整理汇总了Java中com.google.common.collect.ArrayListMultimap.get方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayListMultimap.get方法的具体用法?Java ArrayListMultimap.get怎么用?Java ArrayListMultimap.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.ArrayListMultimap
的用法示例。
在下文中一共展示了ArrayListMultimap.get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyAssignment
import com.google.common.collect.ArrayListMultimap; //导入方法依赖的package包/类
/** Helper method to verify the number of PartitionSenders in a given fragment endpoint assignments */
private static void verifyAssignment(List<Integer> fragmentList,
ArrayListMultimap<Integer, DrillbitEndpoint> partitionSenderMap) {
// We expect at least one entry the list
assertTrue(fragmentList.size() > 0);
for(Integer majorFragmentId : fragmentList) {
// we expect the fragment that has DeMux/HashToRandom as sending exchange to have parallelization with not more
// than the number of nodes in the cluster and each node in the cluster can have at most one assignment
List<DrillbitEndpoint> assignments = partitionSenderMap.get(majorFragmentId);
assertNotNull(assignments);
assertTrue(assignments.size() > 0);
assertTrue(String.format("Number of partition senders in major fragment [%d] is more than expected", majorFragmentId), CLUSTER_SIZE >= assignments.size());
// Make sure there are no duplicates in assigned endpoints (i.e at most one partition sender per endpoint)
assertTrue("Some endpoints have more than one fragment that has ParitionSender", ImmutableSet.copyOf(assignments).size() == assignments.size());
}
}
示例2: publiceerSchrijfTaken
import com.google.common.collect.ArrayListMultimap; //导入方法依赖的package包/类
@Override
public int publiceerSchrijfTaken(final SelectieVerwerkTaakBericht selectieTaak, final Collection<VerwerkPersoonResultaat> resultaten) {
final ArrayListMultimap<Integer, VerwerkPersoonResultaat> berichtenPerSelectietaak = ArrayListMultimap.create();
for (VerwerkPersoonResultaat resultaat : resultaten) {
berichtenPerSelectietaak.put(resultaat.getSelectieTaakId(), resultaat);
}
final List<SelectieFragmentSchrijfBericht> schrijfTaken = new ArrayList<>();
for (SelectieAutorisatieBericht selectieAutorisatie : selectieTaak.getSelectieAutorisaties()) {
final List<VerwerkPersoonResultaat> berichtenVoorAutorisatie = berichtenPerSelectietaak.get(selectieAutorisatie.getSelectietaakId());
if (!berichtenVoorAutorisatie.isEmpty()) {
final SelectieFragmentSchrijfBericht bericht =
maakSelectieFragmentSchrijfBericht(selectieTaak, selectieAutorisatie, berichtenVoorAutorisatie);
schrijfTaken.add(bericht);
}
}
//publiceer xml berichten naar schrijf node
if (!schrijfTaken.isEmpty()) {
selectieSchrijfTaakPublicatieService.publiceerSchrijfTaken(schrijfTaken);
}
return schrijfTaken.size();
}
示例3: mapSorteerAttributen
import com.google.common.collect.ArrayListMultimap; //导入方法依赖的package包/类
private void mapSorteerAttributen() {
final Map<Integer, GroepElement> objectSorteerGroepTemp = Maps.newHashMap();
final ArrayListMultimap<GroepElement, AttribuutElement> sorteerElementenVoorGroep = ArrayListMultimap.create();
for (final AttribuutElement attribuutElement : idAttribuutMap.values()) {
if (attribuutElement.getElement().getElementWaarde().getSorteervolgorde() != null) {
objectSorteerGroepTemp.put(attribuutElement.getObjectType(), idGroepMap.get(attribuutElement.getGroepId()));
sorteerElementenVoorGroep.put(idGroepMap.get(attribuutElement.getGroepId()), attribuutElement);
}
}
objectSorteerGroepMap = ImmutableMap.copyOf(objectSorteerGroepTemp);
final Map<GroepElement, List<AttribuutElement>> gesorteerdeElementenVoorGroepTemp = new HashMap<>();
for (GroepElement groepElement : sorteerElementenVoorGroep.keySet()) {
final List<AttribuutElement> sorteerAttributen = sorteerElementenVoorGroep.get(groepElement);
sorteerAttributen.sort(
Comparator.comparing(o -> o.getElement().getElementWaarde().getSorteervolgorde()));
gesorteerdeElementenVoorGroepTemp.put(groepElement, sorteerAttributen);
}
sorteerAttributenVoorGroep = ImmutableMap.copyOf(gesorteerdeElementenVoorGroepTemp);
}
示例4: RoundRobinOperator
import com.google.common.collect.ArrayListMultimap; //导入方法依赖的package包/类
public RoundRobinOperator(TunnelProvider tunnelProvider, OperatorContext context, RoundRobinSender config) throws OutOfMemoryException {
super(config);
this.config = config;
this.allocator = context.getAllocator();
this.handle = context.getFragmentHandle();
this.stats = context.getStats();
List<MinorFragmentEndpoint> destinations = config.getDestinations();
final ArrayListMultimap<NodeEndpoint, Integer> dests = ArrayListMultimap.create();
for(MinorFragmentEndpoint destination : destinations) {
dests.put(destination.getEndpoint(), destination.getId());
}
this.tunnels = new ArrayList<>();
this.minorFragments = new ArrayList<>();
for(final NodeEndpoint ep : dests.keySet()){
List<Integer> minorsList= dests.get(ep);
minorFragments.add(minorsList);
tunnels.add(tunnelProvider.getExecTunnel(ep));
}
int destCount = dests.keySet().size();
this.currentTunnelsIndex = ThreadLocalRandom.current().nextInt(destCount);
this.currentMinorFragmentsIndex = ThreadLocalRandom.current().nextInt(minorFragments.get(currentTunnelsIndex).size());
}
示例5: verifyAssignment
import com.google.common.collect.ArrayListMultimap; //导入方法依赖的package包/类
/** Helper method to verify the number of PartitionSenders in a given fragment endpoint assignments */
private static void verifyAssignment(List<Integer> fragmentList,
ArrayListMultimap<Integer, NodeEndpoint> partitionSenderMap) {
// We expect at least one entry the list
assertTrue(fragmentList.size() > 0);
for(Integer majorFragmentId : fragmentList) {
// we expect the fragment that has DeMux/HashToRandom as sending exchange to have parallelization with not more
// than the number of nodes in the cluster and each node in the cluster can have at most one assignment
List<NodeEndpoint> assignments = partitionSenderMap.get(majorFragmentId);
assertNotNull(assignments);
assertTrue(assignments.size() > 0);
assertTrue(String.format("Number of partition senders in major fragment [%d] is more than expected", majorFragmentId), CLUSTER_SIZE >= assignments.size());
// Make sure there are no duplicates in assigned endpoints (i.e at most one partition sender per endpoint)
assertTrue("Some endpoints have more than one fragment that has ParitionSender", ImmutableSet.copyOf(assignments).size() == assignments.size());
}
}
示例6: createSenderReceiverMapping
import com.google.common.collect.ArrayListMultimap; //导入方法依赖的package包/类
protected void createSenderReceiverMapping() {
if (isSenderReceiverMappingCreated) {
return;
}
senderToReceiverMapping = Maps.newHashMap();
receiverToSenderMapping = ArrayListMultimap.create();
// Find the list of sender fragment ids assigned to each Drillbit endpoint.
ArrayListMultimap<DrillbitEndpoint, Integer> endpointSenderList = ArrayListMultimap.create();
int senderFragmentId = 0;
for(DrillbitEndpoint senderLocation : senderLocations) {
endpointSenderList.put(senderLocation, senderFragmentId);
senderFragmentId++;
}
int receiverFragmentId = 0;
for(DrillbitEndpoint receiverLocation : receiverLocations) {
List<Integer> senderFragmentIds = endpointSenderList.get(receiverLocation);
for(Integer senderId : senderFragmentIds) {
senderToReceiverMapping.put(senderId, new MinorFragmentEndpoint(receiverFragmentId, receiverLocation));
receiverToSenderMapping.put(receiverFragmentId,
new MinorFragmentEndpoint(senderId, senderLocations.get(senderId)));
}
receiverFragmentId++;
}
isSenderReceiverMappingCreated = true;
}
示例7: createSenderReceiverMapping
import com.google.common.collect.ArrayListMultimap; //导入方法依赖的package包/类
protected void createSenderReceiverMapping() {
if (isSenderReceiverMappingCreated) {
return;
}
senderToReceiversMapping = ArrayListMultimap.create();
receiverToSenderMapping = Maps.newHashMap();
// Find the list of receiver fragment ids assigned to each Drillbit endpoint
ArrayListMultimap<DrillbitEndpoint, Integer> endpointReceiverList = ArrayListMultimap.create();
int receiverFragmentId = 0;
for(DrillbitEndpoint receiverLocation : receiverLocations) {
endpointReceiverList.put(receiverLocation, receiverFragmentId);
receiverFragmentId++;
}
int senderFragmentId = 0;
for(DrillbitEndpoint senderLocation : senderLocations) {
final List<Integer> receiverMinorFragmentIds = endpointReceiverList.get(senderLocation);
for(Integer receiverId : receiverMinorFragmentIds) {
receiverToSenderMapping.put(receiverId, new MinorFragmentEndpoint(senderFragmentId, senderLocation));
senderToReceiversMapping.put(senderFragmentId,
new MinorFragmentEndpoint(receiverId, receiverLocations.get(receiverId)));
}
senderFragmentId++;
}
isSenderReceiverMappingCreated = true;
}
示例8: BroadcastSenderRootExec
import com.google.common.collect.ArrayListMultimap; //导入方法依赖的package包/类
public BroadcastSenderRootExec(FragmentContext context,
RecordBatch incoming,
BroadcastSender config) throws OutOfMemoryException {
super(context, context.newOperatorContext(config, null, false), config);
this.ok = true;
this.incoming = incoming;
this.config = config;
this.handle = context.getHandle();
List<MinorFragmentEndpoint> destinations = config.getDestinations();
ArrayListMultimap<DrillbitEndpoint, Integer> dests = ArrayListMultimap.create();
for(MinorFragmentEndpoint destination : destinations) {
dests.put(destination.getEndpoint(), destination.getId());
}
int destCount = dests.keySet().size();
int i = 0;
this.tunnels = new AccountingDataTunnel[destCount];
this.receivingMinorFragments = new int[destCount][];
for(final DrillbitEndpoint ep : dests.keySet()){
List<Integer> minorsList= dests.get(ep);
int[] minorsArray = new int[minorsList.size()];
int x = 0;
for(Integer m : minorsList){
minorsArray[x++] = m;
}
receivingMinorFragments[i] = minorsArray;
tunnels[i] = context.getDataTunnel(ep);
i++;
}
}
示例9: unRegister
import com.google.common.collect.ArrayListMultimap; //导入方法依赖的package包/类
private void unRegister(ArrayListMultimap<URL, URL> registryUrls) {
for (URL serviceUrl : registryUrls.keySet()) {
for (URL url : registryUrls.get(serviceUrl)) {
try {
RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getExtension(url.getProtocol());
Registry registry = registryFactory.getRegistry(url);
registry.unregister(serviceUrl);
} catch (Exception e) {
logger.warn(String.format("unregister url false:%s", url), e);
}
}
}
}
示例10: createSenderReceiverMapping
import com.google.common.collect.ArrayListMultimap; //导入方法依赖的package包/类
protected void createSenderReceiverMapping() {
if (isSenderReceiverMappingCreated) {
return;
}
senderToReceiverMapping = Maps.newHashMap();
receiverToSenderMapping = ArrayListMultimap.create();
// Find the list of sender fragment ids assigned to each SabotNode endpoint.
ArrayListMultimap<NodeEndpoint, Integer> endpointSenderList = ArrayListMultimap.create();
int senderFragmentId = 0;
for(NodeEndpoint senderLocation : senderLocations) {
endpointSenderList.put(senderLocation, senderFragmentId);
senderFragmentId++;
}
int receiverFragmentId = 0;
for(NodeEndpoint receiverLocation : receiverLocations) {
List<Integer> senderFragmentIds = endpointSenderList.get(receiverLocation);
for(Integer senderId : senderFragmentIds) {
senderToReceiverMapping.put(senderId, new MinorFragmentEndpoint(receiverFragmentId, receiverLocation));
receiverToSenderMapping.put(receiverFragmentId,
new MinorFragmentEndpoint(senderId, senderLocations.get(senderId)));
}
receiverFragmentId++;
}
isSenderReceiverMappingCreated = true;
}
示例11: createSenderReceiverMapping
import com.google.common.collect.ArrayListMultimap; //导入方法依赖的package包/类
protected void createSenderReceiverMapping() {
if (isSenderReceiverMappingCreated) {
return;
}
senderToReceiversMapping = ArrayListMultimap.create();
receiverToSenderMapping = Maps.newHashMap();
// Find the list of receiver fragment ids assigned to each SabotNode endpoint
ArrayListMultimap<NodeEndpoint, Integer> endpointReceiverList = ArrayListMultimap.create();
int receiverFragmentId = 0;
for(NodeEndpoint receiverLocation : receiverLocations) {
endpointReceiverList.put(receiverLocation, receiverFragmentId);
receiverFragmentId++;
}
int senderFragmentId = 0;
for(NodeEndpoint senderLocation : senderLocations) {
final List<Integer> receiverMinorFragmentIds = endpointReceiverList.get(senderLocation);
for(Integer receiverId : receiverMinorFragmentIds) {
receiverToSenderMapping.put(receiverId, new MinorFragmentEndpoint(senderFragmentId, senderLocation));
senderToReceiversMapping.put(senderFragmentId,
new MinorFragmentEndpoint(receiverId, receiverLocations.get(receiverId)));
}
senderFragmentId++;
}
isSenderReceiverMappingCreated = true;
}
示例12: BroadcastOperator
import com.google.common.collect.ArrayListMultimap; //导入方法依赖的package包/类
public BroadcastOperator(TunnelProvider tunnelProvider, OperatorContext context, BroadcastSender config) throws OutOfMemoryException {
super(config);
this.config = config;
this.context = context;
this.handle = context.getFragmentHandle();
this.stats = context.getStats();
final List<MinorFragmentEndpoint> destinations = config.getDestinations();
final ArrayListMultimap<NodeEndpoint, Integer> dests = ArrayListMultimap.create();
for(MinorFragmentEndpoint destination : destinations) {
dests.put(destination.getEndpoint(), destination.getId());
}
int destCount = dests.keySet().size();
int i = 0;
this.tunnels = new AccountingExecTunnel[destCount];
this.receivingMinorFragments = new int[destCount][];
for(final NodeEndpoint ep : dests.keySet()){
List<Integer> minorsList= dests.get(ep);
int[] minorsArray = new int[minorsList.size()];
int x = 0;
for(Integer m : minorsList){
minorsArray[x++] = m;
}
receivingMinorFragments[i] = minorsArray;
tunnels[i] = tunnelProvider.getExecTunnel(ep);
i++;
}
}