@SuppressWarnings("unchecked") protected <BATCH> void sendDownstream(long ticket, BATCH batch) { if (batch == null) { if (downstream != null) { throw new IllegalArgumentException("Expected a batch to send downstream"); } } else { downstreamIdleTime.addAndGet(downstream.receive(ticket, batch)); } }