@Test public void testPutOutOfCapacity() throws OutOfCapacityException { Map<String, Object> properties = new HashMap<>(); properties.put(MultiLevelPriorityQueue.MAX_PENDING_PER_GROUP_KEY, 2); PinotConfiguration configuration =new PinotConfiguration(properties); ResourceManager rm = new UnboundedResourceManager(configuration); MultiLevelPriorityQueue queue = createQueue(configuration, rm); queue.put(createQueryRequest(groupOne, metrics)); groupFactory.groupMap.get(groupOne).addReservedThreads(rm.getTableThreadsHardLimit()); queue.put(createQueryRequest(groupOne, metrics)); assertTrue(true); try { queue.put(createQueryRequest(groupOne, metrics)); } catch (OutOfCapacityException e) { assertTrue(true); return; } assertTrue(false); }
@Override public void put(@Nonnull SchedulerQueryContext query) throws OutOfCapacityException { Preconditions.checkNotNull(query); queueLock.lock(); String groupName = groupSelector.getSchedulerGroupName(query); try { SchedulerGroup groupContext = getOrCreateGroupContext(groupName); checkGroupHasCapacity(groupContext); query.setSchedulerGroupContext(groupContext); groupContext.addLast(query); queryReaderCondition.signal(); } finally { queueLock.unlock(); } }
MultiLevelPriorityQueue implements SchedulerPriorityQueue { @Override public void put(@Nonnull SchedulerQueryContext query) throws OutOfCapacityException { Preconditions.checkNotNull(query); queueLock.lock(); String groupName = groupSelector.getSchedulerGroupName(query); try { SchedulerGroup groupContext = getOrCreateGroupContext(groupName); checkGroupHasCapacity(groupContext); query.setSchedulerGroupContext(groupContext); groupContext.addLast(query); queryReaderCondition.signal(); } finally { queueLock.unlock(); } } }
MultiLevelPriorityQueue implements SchedulerPriorityQueue { @Override public void put(@Nonnull SchedulerQueryContext query) throws OutOfCapacityException { Preconditions.checkNotNull(query); queueLock.lock(); String groupName = groupSelector.getSchedulerGroupName(query); try { SchedulerGroup groupContext = getOrCreateGroupContext(groupName); checkGroupHasCapacity(groupContext); query.setSchedulerGroupContext(groupContext); groupContext.addLast(query); queryReaderCondition.signal(); } finally { queueLock.unlock(); } } MultiLevelPriorityQueue(@Nonnull PinotConfiguration config, @Nonnull ResourceManager resourceManager,
      @Nonnull SchedulerGroupFactory groupFactory, @Nonnull SchedulerGroupMapper groupMapper); }
MultiLevelPriorityQueue implements SchedulerPriorityQueue { @Override public void put(@Nonnull SchedulerQueryContext query) throws OutOfCapacityException { Preconditions.checkNotNull(query); queueLock.lock(); String groupName = groupSelector.getSchedulerGroupName(query); try { SchedulerGroup groupContext = getOrCreateGroupContext(groupName); checkGroupHasCapacity(groupContext); query.setSchedulerGroupContext(groupContext); groupContext.addLast(query); queryReaderCondition.signal(); } finally { queueLock.unlock(); } } MultiLevelPriorityQueue(@Nonnull PinotConfiguration config, @Nonnull ResourceManager resourceManager,
      @Nonnull SchedulerGroupFactory groupFactory, @Nonnull SchedulerGroupMapper groupMapper); @Override void put(@Nonnull SchedulerQueryContext query); @Nullable @Override SchedulerQueryContext take(); @Nonnull @Override List<SchedulerQueryContext> drain(); }
MultiLevelPriorityQueue implements SchedulerPriorityQueue { @Override public void put(@Nonnull SchedulerQueryContext query) throws OutOfCapacityException { Preconditions.checkNotNull(query); queueLock.lock(); String groupName = groupSelector.getSchedulerGroupName(query); try { SchedulerGroup groupContext = getOrCreateGroupContext(groupName); checkGroupHasCapacity(groupContext); query.setSchedulerGroupContext(groupContext); groupContext.addLast(query); queryReaderCondition.signal(); } finally { queueLock.unlock(); } } MultiLevelPriorityQueue(@Nonnull PinotConfiguration config, @Nonnull ResourceManager resourceManager,
      @Nonnull SchedulerGroupFactory groupFactory, @Nonnull SchedulerGroupMapper groupMapper); @Override void put(@Nonnull SchedulerQueryContext query); @Nullable @Override SchedulerQueryContext take(); @Nonnull @Override List<SchedulerQueryContext> drain(); static final String QUERY_DEADLINE_SECONDS_KEY; static final String MAX_PENDING_PER_GROUP_KEY; static final String QUEUE_WAKEUP_MICROS; }