public QueueManager(QueueSetListener queueSetListener, long maxWaitForLowPriorityInMs) { this.highPriorityQueueSet = new QueueSet(queueSetListener); this.lowPriorityQueueSet = new QueueSet(queueSetListener); this.starvablePriorityQueueSet = new QueueSet(queueSetListener); // call to verify and set values setMaxWaitForLowPriority(maxWaitForLowPriorityInMs); }
/** * Changes the max wait time for low priority tasks. This is the amount of time that a low * priority task will wait if there are ready to execute high priority tasks. After a low * priority task has waited this amount of time, it will be executed fairly with high priority * tasks (meaning it will only execute the high priority task if it has been waiting longer than * the low priority task). * * @param maxWaitForLowPriorityInMs new wait time in milliseconds for low priority tasks during thread contention */ public void setMaxWaitForLowPriority(long maxWaitForLowPriorityInMs) { getQueueManager().setMaxWaitForLowPriority(maxWaitForLowPriorityInMs); }
@Test public void getAndSetLowPriorityWaitTest() { assertEquals(AbstractPriorityScheduler.DEFAULT_LOW_PRIORITY_MAX_WAIT_IN_MS, queueManager.getMaxWaitForLowPriority()); long lowPriorityWait = Long.MAX_VALUE; queueManager.setMaxWaitForLowPriority(lowPriorityWait); assertEquals(lowPriorityWait, queueManager.getMaxWaitForLowPriority()); }
/** * Changes the max wait time for low priority tasks. This is the amount of time that a low * priority task will wait if there are ready to execute high priority tasks. After a low * priority task has waited this amount of time, it will be executed fairly with high priority * tasks (meaning it will only execute the high priority task if it has been waiting longer than * the low priority task). * * @param maxWaitForLowPriorityInMs new wait time in milliseconds for low priority tasks during thread contention */ public void setMaxWaitForLowPriority(long maxWaitForLowPriorityInMs) { getQueueManager().setMaxWaitForLowPriority(maxWaitForLowPriorityInMs); }
public QueueManager(QueueSetListener queueSetListener, long maxWaitForLowPriorityInMs) { this.highPriorityQueueSet = new QueueSet(queueSetListener); this.lowPriorityQueueSet = new QueueSet(queueSetListener); this.starvablePriorityQueueSet = new QueueSet(queueSetListener); // call to verify and set values setMaxWaitForLowPriority(maxWaitForLowPriorityInMs); }
@Test public void setLowPriorityWaitFail() { try { queueManager.setMaxWaitForLowPriority(-1); fail("Exception should have thrown"); } catch (IllegalArgumentException e) { // expected } assertEquals(AbstractPriorityScheduler.DEFAULT_LOW_PRIORITY_MAX_WAIT_IN_MS, queueManager.getMaxWaitForLowPriority()); } }