@Override public <T extends Request<T>> RequestAllocator<T> createRequestAllocator(RequestAllocatorConfig<T> cofiguration) { Preconditions.checkArgument(cofiguration.getPrioritizer() instanceof HierarchicalPrioritizer, "Prioritizer must be a " + HierarchicalPrioritizer.class.getSimpleName()); RequestAllocator<T> underlying = RequestAllocatorUtils.inferFromConfig(cofiguration); return new HierarchicalAllocator<>((HierarchicalPrioritizer<T>) cofiguration.getPrioritizer(), underlying); } }
RequestAllocatorConfig.builder(new StringRequest.StringRequestEstimator()).withPrioritizer(prioritizer).build(); BruteForceAllocator<StringRequest> underlying = new BruteForceAllocator<>(configuration); HierarchicalAllocator<StringRequest> hierarchicalAllocator = new HierarchicalAllocator<>(prioritizer, underlying); ResourcePool pool = ResourcePool.builder().maxResource(StringRequest.MEMORY, 45.).build(); AllocatedRequestsIterator<StringRequest> result = hierarchicalAllocator.allocateRequests(requests.iterator(), pool); List<StringRequest> resultList = Lists.newArrayList(result);
@Override public <T extends Request<T>> RequestAllocator<T> createRequestAllocator(RequestAllocatorConfig<T> cofiguration) { Preconditions.checkArgument(cofiguration.getPrioritizer() instanceof HierarchicalPrioritizer, "Prioritizer must be a " + HierarchicalPrioritizer.class.getSimpleName()); RequestAllocator<T> underlying = RequestAllocatorUtils.inferFromConfig(cofiguration); return new HierarchicalAllocator<>((HierarchicalPrioritizer<T>) cofiguration.getPrioritizer(), underlying); } }