class QueueSynchronizationProcessor extends ReplyProcessor21 {

  static List<EventID> getDispatchedEvents(final DistributionManager dm,
      final InternalDistributedMember primary, String regionName, List<EventID> events) {
    QueueSynchronizationProcessor processor = new QueueSynchronizationProcessor(dm, primary);

    QueueSynchronizationMessage message = new QueueSynchronizationMessage();
    message.setEventIdList(events);
    message.setProcessorId(processor.getProcessorId());
    message.setRegionName(regionName);

    message.setRecipient(primary);
    dm.putOutgoing(message);

    try {
      processor.waitForRepliesUninterruptibly();
    } catch (ReplyException e) {
      e.handleCause();
    }

    if (processor.reply != null) {
      return processor.reply.getDispatchedEvents();
    }
    // Failed to get reply.
    return null;
  }

    QueueSynchronizationProcessor(DistributionManager dm, InternalDistributedMember primary);

}