public void takeOverflow(int takeCount) { MutableInteger headValue = queue.getFirst(); if (headValue.intValue() > -takeCount) { throw new IllegalStateException("Cannot take " + takeCount + " from " + headValue.intValue() + " in DrainOrder Queue head "); } headValue.add(takeCount); if (headValue.intValue() == 0) { queue.removeFirst(); } overflowCounter -= takeCount; }
public void putOverflow(Integer eventCount) { totalPuts += eventCount; if ((queue.peekLast() == null) || queue.getLast().intValue() > 0) { queue.addLast(new MutableInteger(-eventCount)); } else { queue.getLast().add(-eventCount); } overflowCounter += eventCount; }
public void putPrimary(Integer eventCount) { totalPuts += eventCount; if ((queue.peekLast() == null) || queue.getLast().intValue() < 0) { queue.addLast(new MutableInteger(eventCount)); } else { queue.getLast().add(eventCount); } }
public void takeOverflow(int takeCount) { MutableInteger headValue = queue.getFirst(); if (headValue.intValue() > -takeCount) { throw new IllegalStateException("Cannot take " + takeCount + " from " + headValue.intValue() + " in DrainOrder Queue head "); } headValue.add(takeCount); if (headValue.intValue() == 0) { queue.removeFirst(); } overflowCounter -= takeCount; }
public void putOverflow(Integer eventCount) { totalPuts += eventCount; if ((queue.peekLast() == null) || queue.getLast().intValue() > 0) { queue.addLast(new MutableInteger(-eventCount)); } else { queue.getLast().add(-eventCount); } overflowCounter += eventCount; }
public void takePrimary(int takeCount) { MutableInteger headValue = queue.getFirst(); // this condition is optimization to avoid redundant conversions of // int -> Integer -> string in hot path if (headValue.intValue() < takeCount) { throw new IllegalStateException("Cannot take " + takeCount + " from " + headValue.intValue() + " in DrainOrder Queue"); } headValue.add(-takeCount); if (headValue.intValue() == 0) { queue.removeFirst(); } }
public void putFirstPrimary(Integer eventCount) { if ((queue.peekFirst() == null) || queue.getFirst().intValue() < 0) { queue.addFirst(new MutableInteger(eventCount)); } else { queue.getFirst().add(eventCount); } }
public void putFirstOverflow(Integer eventCount) { if ((queue.peekFirst() == null) || queue.getFirst().intValue() > 0) { queue.addFirst(new MutableInteger(-eventCount)); } else { queue.getFirst().add(-eventCount); } overflowCounter += eventCount; }
public void putPrimary(Integer eventCount) { totalPuts += eventCount; if ((queue.peekLast() == null) || queue.getLast().intValue() < 0) { queue.addLast(new MutableInteger(eventCount)); } else { queue.getLast().add(eventCount); } }
public void takePrimary(int takeCount) { MutableInteger headValue = queue.getFirst(); // this condition is optimization to avoid redundant conversions of // int -> Integer -> string in hot path if (headValue.intValue() < takeCount) { throw new IllegalStateException("Cannot take " + takeCount + " from " + headValue.intValue() + " in DrainOrder Queue"); } headValue.add(-takeCount); if (headValue.intValue() == 0) { queue.removeFirst(); } }
public void putFirstPrimary(Integer eventCount) { if ((queue.peekFirst() == null) || queue.getFirst().intValue() < 0) { queue.addFirst(new MutableInteger(eventCount)); } else { queue.getFirst().add(eventCount); } }
public void putFirstOverflow(Integer eventCount) { if ((queue.peekFirst() == null) || queue.getFirst().intValue() > 0) { queue.addFirst(new MutableInteger(-eventCount)); } else { queue.getFirst().add(-eventCount); } overflowCounter += eventCount; }