@Test void GetIngestionResource_AggregationQueue_VerifyRoundRubin() throws IngestionServiceException, IngestionClientException { List<String> availableQueues = new ArrayList<>(Arrays.asList(QUEUE_1, QUEUE_2)); String queue = resourceManager .getIngestionResource(ResourceManager.ResourceType.SECURED_READY_FOR_AGGREGATION_QUEUE); int lastIndex = availableQueues.indexOf(queue); for (int i = 0; i < 10; i++) { queue = resourceManager .getIngestionResource(ResourceManager.ResourceType.SECURED_READY_FOR_AGGREGATION_QUEUE); int currIdx = availableQueues.indexOf(queue); assertEquals((lastIndex + 1) % availableQueues.size(), currIdx); lastIndex = currIdx; } }
String getIngestionResource(ResourceType resourceType) throws IngestionServiceException, IngestionClientException { if (!ingestionResources.containsKey(resourceType)) { refreshIngestionResources(); try { ingestionResourcesLock.readLock().lock(); if (!ingestionResources.containsKey(resourceType)) { throw new IngestionServiceException("Unable to get ingestion resources for this type: " + resourceType.getName()); } } finally { ingestionResourcesLock.readLock().unlock(); } } return ingestionResources.get(resourceType).nextValue(); }
ResourceManager implements Closeable { String getIngestionResource(ResourceType resourceType) throws IngestionServiceException, IngestionClientException { if (!ingestionResources.containsKey(resourceType)) { refreshIngestionResources(); try { ingestionResourcesLock.readLock().lock(); if (!ingestionResources.containsKey(resourceType)) { throw new IngestionServiceException("Unable to get ingestion resources for this type: " + resourceType.getName()); } } finally { ingestionResourcesLock.readLock().unlock(); } } return ingestionResources.get(resourceType).nextValue(); } }
ResourceManager implements Closeable { String getIngestionResource(ResourceType resourceType) throws IngestionServiceException, IngestionClientException { if (!ingestionResources.containsKey(resourceType)) { refreshIngestionResources(); try { ingestionResourcesLock.readLock().lock(); if (!ingestionResources.containsKey(resourceType)) { throw new IngestionServiceException("Unable to get ingestion resources for this type: " + resourceType.getName()); } } finally { ingestionResourcesLock.readLock().unlock(); } } return ingestionResources.get(resourceType).nextValue(); } ResourceManager(Client client, long defaultRefreshTime, long refreshTimeOnFailure);   ResourceManager(Client client); }
ResourceManager implements Closeable { String getIngestionResource(ResourceType resourceType) throws IngestionServiceException, IngestionClientException { if (!ingestionResources.containsKey(resourceType)) { refreshIngestionResources(); try { ingestionResourcesLock.readLock().lock(); if (!ingestionResources.containsKey(resourceType)) { throw new IngestionServiceException("Unable to get ingestion resources for this type: " + resourceType.getName()); } } finally { ingestionResourcesLock.readLock().unlock(); } } return ingestionResources.get(resourceType).nextValue(); } ResourceManager(Client client, long defaultRefreshTime, long refreshTimeOnFailure);   ResourceManager(Client client); @Override void close(); }
ResourceManager implements Closeable { String getIngestionResource(ResourceType resourceType) throws IngestionServiceException, IngestionClientException { if (!ingestionResources.containsKey(resourceType)) { refreshIngestionResources(); try { ingestionResourcesLock.readLock().lock(); if (!ingestionResources.containsKey(resourceType)) { throw new IngestionServiceException("Unable to get ingestion resources for this type: " + resourceType.getName()); } } finally { ingestionResourcesLock.readLock().unlock(); } } return ingestionResources.get(resourceType).nextValue(); } ResourceManager(Client client, long defaultRefreshTime, long refreshTimeOnFailure);   ResourceManager(Client client); @Override void close();  }