Source:
protected void channelRead0(final ChannelHandlerContext context, final RejectedNotification rejectedNotification) { log.debug("APNs gateway rejected notification with sequence number from ({}).", rejectedNotification.getSequenceNumber(), this.apnsConnection.name, rejectedNotification.getReason()); this.apnsConnection.rejectionReceived = true; this.apnsConnection.sentNotificationBuffer.clearNotificationsBeforeSequenceNumber(rejectedNotification.getSequenceNumber()); final boolean isKnownBadRejection = this.apnsConnection.shutdownNotification != null && (rejectedNotification.getSequenceNumber() == this.apnsConnection.shutdownNotification.getSequenceNumber() || rejectedNotification.getSequenceNumber() == 0); if (!isKnownBadRejection && !RejectedNotificationReason.SHUTDOWN.equals(rejectedNotification.getReason())) { final T notification = this.apnsConnection.sentNotificationBuffer.getNotificationWithSequenceNumber( rejectedNotification.getSequenceNumber()); if (notification != null) { if (this.apnsConnection.listener != null) { this.apnsConnection.listener.handleRejectedNotification( this.apnsConnection, notification, rejectedNotification.getReason()); } } else { log.error("{} failed to find rejected notification with sequence number (buffer has range to " + "{}); this may mean the sent notification buffer is too small. Please report this as a bug.", this.apnsConnection.name, rejectedNotification.getSequenceNumber(), this.apnsConnection.sentNotificationBuffer.getLowestSequenceNumber(), this.apnsConnection.sentNotificationBuffer.getHighestSequenceNumber()); } } if (rejectedNotification.getSequenceNumber() != 0) { final Collection<T> unprocessedNotifications = this.apnsConnection.sentNotificationBuffer.getAllNotificationsAfterSequenceNumber( rejectedNotification.getSequenceNumber()); if (!unprocessedNotifications.isEmpty()) { if (this.apnsConnection.listener != null) { this.apnsConnection.listener.handleUnprocessedNotifications(this.apnsConnection, unprocessedNotifications); } } } this.apnsConnection.sentNotificationBuffer.clearAllNotifications(); }

Target:
protected void channelRead0(final ChannelHandlerContext context, final RejectedNotification rejectedNotification) { log.debug("APNs gateway rejected notification with sequence number from ({}).", rejectedNotification.getSequenceNumber(), this.apnsConnection.name, rejectedNotification.getReason()); this.apnsConnection.rejectionReceived = true; this.apnsConnection.sentNotificationBuffer.clearNotificationsBeforeSequenceNumber(rejectedNotification.getSequenceNumber()); final boolean isKnownBadRejection = this.apnsConnection.shutdownNotification != null && (rejectedNotification.getSequenceNumber() == this.apnsConnection.shutdownNotification.getSequenceNumber() || (rejectedNotification.getSequenceNumber() == 0 && RejectedNotificationReason.MISSING_TOKEN.equals(rejectedNotification.getReason()))); if (!isKnownBadRejection && !RejectedNotificationReason.SHUTDOWN.equals(rejectedNotification.getReason())) { final T notification = this.apnsConnection.sentNotificationBuffer.getNotificationWithSequenceNumber( rejectedNotification.getSequenceNumber()); if (notification != null) { if (this.apnsConnection.listener != null) { this.apnsConnection.listener.handleRejectedNotification( this.apnsConnection, notification, rejectedNotification.getReason()); } } else { log.error("{} failed to find rejected notification with sequence number (buffer has range to " + "{}); this may mean the sent notification buffer is too small. Please report this as a bug.", this.apnsConnection.name, rejectedNotification.getSequenceNumber(), this.apnsConnection.sentNotificationBuffer.getLowestSequenceNumber(), this.apnsConnection.sentNotificationBuffer.getHighestSequenceNumber()); } } if (rejectedNotification.getSequenceNumber() != 0) { final Collection<T> unprocessedNotifications = this.apnsConnection.sentNotificationBuffer.getAllNotificationsAfterSequenceNumber( rejectedNotification.getSequenceNumber()); if (!unprocessedNotifications.isEmpty()) { if (this.apnsConnection.listener != null) { this.apnsConnection.listener.handleUnprocessedNotifications(this.apnsConnection, unprocessedNotifications); } } } this.apnsConnection.sentNotificationBuffer.clearAllNotifications(); }