FairCallQueue extends AbstractQueue<E> implements BlockingQueue<E> { @Override public int remainingCapacity() { int sum = 0; for (BlockingQueue<E> q : this.queues) { sum += q.remainingCapacity(); } return sum; } FairCallQueue(int priorityLevels, int capacity, String ns,
      Configuration conf); @Override boolean add(E e); @Override void put(E e); @Override boolean offer(E e, long timeout, TimeUnit unit); @Override boolean offer(E e); @Override E take(); @Override E poll(long timeout, TimeUnit unit); @Override E poll(); @Override E peek(); @Override int size(); @Override Iterator<E> iterator(); @Override int drainTo(Collection<? super E> c, int maxElements); @Override int drainTo(Collection<? super E> c); @Override int remainingCapacity(); int[] getQueueSizes(); long[] getOverflowedCalls(); @VisibleForTesting void setMultiplexer(RpcMultiplexer newMux); @Deprecated
  static final int IPC_CALLQUEUE_PRIORITY_LEVELS_DEFAULT; @Deprecated
  static final String IPC_CALLQUEUE_PRIORITY_LEVELS_KEY; static final Logger LOG; }
@Test public void testTotalCapacityOfSubQueues() { Configuration conf = new Configuration(); FairCallQueue<Schedulable> fairCallQueue; fairCallQueue = new FairCallQueue<Schedulable>(1, 1000, "ns", conf); assertEquals(fairCallQueue.remainingCapacity(), 1000); fairCallQueue = new FairCallQueue<Schedulable>(4, 1000, "ns", conf); assertEquals(fairCallQueue.remainingCapacity(), 1000); fairCallQueue = new FairCallQueue<Schedulable>(7, 1000, "ns", conf); assertEquals(fairCallQueue.remainingCapacity(), 1000); fairCallQueue = new FairCallQueue<Schedulable>(1, 1025, "ns", conf); assertEquals(fairCallQueue.remainingCapacity(), 1025); fairCallQueue = new FairCallQueue<Schedulable>(4, 1025, "ns", conf); assertEquals(fairCallQueue.remainingCapacity(), 1025); fairCallQueue = new FairCallQueue<Schedulable>(7, 1025, "ns", conf); assertEquals(fairCallQueue.remainingCapacity(), 1025); }
@Test public void testInitialRemainingCapacity() { assertEquals(10, fcq.remainingCapacity()); }