Java Code Examples for org.apache.flink.shaded.guava18.com.google.common.collect.Sets#newHashSet()
The following examples show how to use
org.apache.flink.shaded.guava18.com.google.common.collect.Sets#newHashSet() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TaskExecutor.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private void freeNoLongerUsedSlots(AllocatedSlotReport allocatedSlotReport) { final Iterator<AllocationID> slotsTaskManagerSide = taskSlotTable.getActiveSlots(allocatedSlotReport.getJobId()); final Set<AllocationID> activeSlots = Sets.newHashSet(slotsTaskManagerSide); final Set<AllocationID> reportedSlots = allocatedSlotReport.getAllocatedSlotInfos().stream() .map(AllocatedSlotInfo::getAllocationId).collect(Collectors.toSet()); final Sets.SetView<AllocationID> difference = Sets.difference(activeSlots, reportedSlots); for (AllocationID allocationID : difference) { freeSlotInternal( allocationID, new FlinkException( String.format("%s is no longer allocated by job %s.", allocationID, allocatedSlotReport.getJobId()))); } }
Example 2
Source File: DiscovererTest.java From pulsar-flink with Apache License 2.0 | 5 votes |
@Test public void testPartitionEqualConsumerNumber() { try { Set<String> mockAllTopics = Sets.newHashSet( topicName(TEST_TOPIC, 0), topicName(TEST_TOPIC, 1), topicName(TEST_TOPIC, 2), topicName(TEST_TOPIC, 3)); int numSubTasks = mockAllTopics.size(); for (int i = 0; i < numSubTasks; i++) { TestMetadataReader discoverer = new TestMetadataReader( params, i, numSubTasks, TestMetadataReader.createMockGetAllTopicsSequenceFromFixedReturn(mockAllTopics)); Set<String> initials = discoverer.discoverTopicChanges(); assertEquals(1, initials.size()); assertTrue(mockAllTopics.containsAll(initials)); assertEquals(i, TestMetadataReader.getExpectedSubtaskIndex(initials.iterator().next(), numSubTasks)); Set<String> second = discoverer.discoverTopicChanges(); Set<String> third = discoverer.discoverTopicChanges(); assertEquals(second.size(), 0); assertEquals(third.size(), 0); } } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
Example 3
Source File: TaskExecutor.java From flink with Apache License 2.0 | 5 votes |
private void freeNoLongerUsedSlots(AllocatedSlotReport allocatedSlotReport) { final Iterator<AllocationID> slotsTaskManagerSide = taskSlotTable.getActiveSlots(allocatedSlotReport.getJobId()); final Set<AllocationID> activeSlots = Sets.newHashSet(slotsTaskManagerSide); final Set<AllocationID> reportedSlots = allocatedSlotReport.getAllocatedSlotInfos().stream() .map(AllocatedSlotInfo::getAllocationId).collect(Collectors.toSet()); final Sets.SetView<AllocationID> difference = Sets.difference(activeSlots, reportedSlots); for (AllocationID allocationID : difference) { freeSlotInternal( allocationID, new FlinkException( String.format("%s is no longer allocated by job %s.", allocationID, allocatedSlotReport.getJobId()))); } }
Example 4
Source File: TaskExecutor.java From flink with Apache License 2.0 | 5 votes |
private void freeNoLongerUsedSlots(AllocatedSlotReport allocatedSlotReport) { final Iterator<AllocationID> slotsTaskManagerSide = taskSlotTable.getActiveSlots(allocatedSlotReport.getJobId()); final Set<AllocationID> activeSlots = Sets.newHashSet(slotsTaskManagerSide); final Set<AllocationID> reportedSlots = allocatedSlotReport.getAllocatedSlotInfos().stream() .map(AllocatedSlotInfo::getAllocationId).collect(Collectors.toSet()); final Sets.SetView<AllocationID> difference = Sets.difference(activeSlots, reportedSlots); for (AllocationID allocationID : difference) { freeSlotInternal( allocationID, new FlinkException( String.format("%s is no longer allocated by job %s.", allocationID, allocatedSlotReport.getJobId()))); } }
Example 5
Source File: DefaultExecutionTopologyTest.java From flink with Apache License 2.0 | 4 votes |
private void assertRegionContainsAllVertices(final DefaultSchedulingPipelinedRegion pipelinedRegionOfVertex) { final Set<DefaultExecutionVertex> allVertices = Sets.newHashSet(pipelinedRegionOfVertex.getVertices()); assertEquals(Sets.newHashSet(adapter.getVertices()), allVertices); }