@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); } }
@Override protected Iterator<T> getJoinIterator(Iterator<? extends Requestor<T>> requestors, final ConcurrentBoundedPriorityIterable<T> requestIterable) { List<Iterator<T>> iteratorList = Lists.newArrayList(); while (requestors.hasNext()) { Requestor<T> requestor = requestors.next(); if (!(requestor instanceof PushDownRequestor)) { throw new RuntimeException(String.format("%s can only be used with %s.", PreOrderAllocator.class, PushDownRequestor.class)); } try { iteratorList.add(((PushDownRequestor<T>) requestor).getRequests(getConfiguration().getPrioritizer())); } catch (IOException ioe) { log.error("Failed to get requests from " + requestor); } } PriorityMultiIterator<T> multiIterator = new PriorityMultiIterator<>(iteratorList, getConfiguration().getPrioritizer()); return new InterruptibleIterator<>(multiIterator, new Callable<Boolean>() { @Override public Boolean call() throws Exception { return requestIterable.isFull(); } }); } }
ResourcePool resourcePool) { final ConcurrentBoundedPriorityIterable<T> iterable = new ConcurrentBoundedPriorityIterable<>(this.configuration.getPrioritizer(), this.configuration.getResourceEstimator(), this.configuration.getStoreRejectedRequestsSetting(), resourcePool);
@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); } }
@Override protected Iterator<T> getJoinIterator(Iterator<? extends Requestor<T>> requestors, final ConcurrentBoundedPriorityIterable<T> requestIterable) { List<Iterator<T>> iteratorList = Lists.newArrayList(); while (requestors.hasNext()) { Requestor<T> requestor = requestors.next(); if (!(requestor instanceof PushDownRequestor)) { throw new RuntimeException(String.format("%s can only be used with %s.", PreOrderAllocator.class, PushDownRequestor.class)); } try { iteratorList.add(((PushDownRequestor<T>) requestor).getRequests(getConfiguration().getPrioritizer())); } catch (IOException ioe) { log.error("Failed to get requests from " + requestor); } } PriorityMultiIterator<T> multiIterator = new PriorityMultiIterator<>(iteratorList, getConfiguration().getPrioritizer()); return new InterruptibleIterator<>(multiIterator, new Callable<Boolean>() { @Override public Boolean call() throws Exception { return requestIterable.isFull(); } }); } }
ResourcePool resourcePool) { final ConcurrentBoundedPriorityIterable<T> iterable = new ConcurrentBoundedPriorityIterable<>(this.configuration.getPrioritizer(), this.configuration.getResourceEstimator(), this.configuration.getStoreRejectedRequestsSetting(), resourcePool);