Source:
<code>private Map<Partition, SystemStreamPartitionMetadata> getPartitionMetadata(String streamName, String[] partitionIds) { EventHubClientWrapper eventHubClientWrapper = getStreamEventHubClient(streamName); Map<Partition, SystemStreamPartitionMetadata> sspMetadataMap = new HashMap<>(); Map<String, CompletableFuture<EventHubPartitionRuntimeInformation>> ehRuntimeInfos = new HashMap<>(); for (String partition : partitionIds) { ehRuntimeInfos.put(partition, eventHubClientWrapper.getEventHubClient() .getPartitionRuntimeInformation(partition)); } ehRuntimeInfos.forEach((partitionId, ehPartitionRuntimeInfo) -> { try { EventHubPartitionRuntimeInformation ehPartitionInfo = ehPartitionRuntimeInfo .get(eventHubConfig.getRuntimeInfoWaitTimeMS(), TimeUnit.MILLISECONDS); sspMetadataMap.put(new Partition(Integer.parseInt(partitionId)), new SystemStreamPartitionMetadata(EventHubSystemConsumer.START_OF_STREAM, ehPartitionInfo.getLastEnqueuedOffset(), EventHubSystemConsumer.END_OF_STREAM)); } catch (InterruptedException | ExecutionException e) { String msg = String.format( "Error while fetching EventHubPartitionRuntimeInfo for System:%s, Stream:%s, Partition:%s", systemName, streamName, partitionId); LOG.error(msg, e); <START> throw new SamzaException(msg); <END> } catch (TimeoutException e) { String msg = String.format( "Timed out while fetching EventHubRuntimeInfo for System:%s, Stream:%s, , Partition:%s", systemName, streamName, partitionId); LOG.error(msg, e); throw new SamzaException(msg); } }); return sspMetadataMap; }</code><technical_language>closed</technical_language>

Target:
private Map<Partition, SystemStreamPartitionMetadata> getPartitionMetadata(String streamName, String[] partitionIds) { EventHubClientManager eventHubClientManager = getOrCreateStreamEventHubClient(streamName); Map<Partition, SystemStreamPartitionMetadata> sspMetadataMap = new HashMap<>(); Map<String, CompletableFuture<EventHubPartitionRuntimeInformation>> ehRuntimeInfos = new HashMap<>(); for (String partition : partitionIds) { CompletableFuture<EventHubPartitionRuntimeInformation> partitionRuntimeInfo = eventHubClientManager .getEventHubClient() .getPartitionRuntimeInformation(partition); ehRuntimeInfos.put(partition, partitionRuntimeInfo); } ehRuntimeInfos.forEach((partitionId, ehPartitionRuntimeInfo) -> { try { long timeoutMs = eventHubConfig.getRuntimeInfoWaitTimeMS(systemName); EventHubPartitionRuntimeInformation ehPartitionInfo = ehPartitionRuntimeInfo.get(timeoutMs, TimeUnit.MILLISECONDS); String startingOffset = EventHubSystemConsumer.START_OF_STREAM; String newestOffset = ehPartitionInfo.getLastEnqueuedOffset(); String upcomingOffset = getNextOffset(newestOffset); SystemStreamPartitionMetadata sspMetadata = new SystemStreamPartitionMetadata(startingOffset, newestOffset, upcomingOffset); Partition partition = new Partition(Integer.parseInt(partitionId)); sspMetadataMap.put(partition, sspMetadata); } catch (InterruptedException | ExecutionException | TimeoutException e) { String msg = String.format( "Error while fetching EventHubPartitionRuntimeInfo for System:%s, Stream:%s, Partition:%s", systemName, streamName, partitionId); throw new SamzaException(msg); } }); return sspMetadataMap; }