@Override
  public void removeCacheListener() {
    AttributesMutator<Long, AsyncEvent<?, ?>> mutator = region.getAttributesMutator();
    CacheListener<Long, AsyncEvent<?, ?>>[] listeners = region.getAttributes().getCacheListeners();
    for (CacheListener<Long, AsyncEvent<?, ?>> listener : listeners) {
      if (listener instanceof SerialSecondaryGatewayListener) {
        mutator.removeCacheListener(listener);
        break;
      }
    }
  }
This method removes batchSize entries from the queue. It will only remove entries that were
previously peeked.

@param size the number of entries to remove
geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueue.java