agave-notifications/notifications-core/src/main/java/org/iplantc/service/notification/events/NotificationAttemptProcessor.java
/**
	 * Handles cleanup after a {@link NotificationAttempt} fails to 
	 * deliver its message. This will check whether the
	 * 
	 * @throws NotificationPolicyViolationException
	 * @throws NotificationException
	 */
Handles cleanup after a  NotificationAttempt fails to
deliver its message. This will check whether the


Handles cleanup after a NotificationAttempt fails to deliver its message . This will check whether the
protected void handleFailure(NotificationAttempt attempt) 
	{
		try {
			NotificationAttemptBackoffCalculator calculator = new NotificationAttemptBackoffCalculator(getNotification().getPolicy(), attempt);
			int secondsUntilNextScheduledAttempt = calculator.getNextScheduledTime();
			attempt.setAttemptNumber(attempt.getAttemptNumber() + 1);
			Instant nextScheduledAttempt = Instant.now().plusSeconds(secondsUntilNextScheduledAttempt);
			attempt.setScheduledTime(nextScheduledAttempt);
			setAttempt(attempt);
			pushNotificationAttemptToRetryQueue(getAttempt(), secondsUntilNextScheduledAttempt);
		} 
		catch (NotificationPolicyViolationException e) {
			handlePolicyViolation(getNotification().getPolicy(), getAttempt());
		}
		catch (Exception e) {
			log.debug("Failed to cleanup notification " + attempt.getNotificationId() + 
					" after attempt " + attempt.getUuid() + 
					". Attempt will be preserved in the failed notification queue.");
			saveFailedAttempt(attempt);
		}
	}
protected void handleFailure ( NotificationAttempt attempt ) { try { NotificationAttemptBackoffCalculator calculator = new NotificationAttemptBackoffCalculator ( getNotification ( ) . getPolicy ( ) , attempt ) ; int secondsUntilNextScheduledAttempt = calculator . getNextScheduledTime ( ) ; attempt . setAttemptNumber ( attempt . getAttemptNumber ( ) + 1 ) ; Instant nextScheduledAttempt = Instant . now ( ) . plusSeconds ( secondsUntilNextScheduledAttempt ) ; attempt . setScheduledTime ( nextScheduledAttempt ) ; setAttempt ( attempt ) ; pushNotificationAttemptToRetryQueue ( getAttempt ( ) , secondsUntilNextScheduledAttempt ) ; } catch ( NotificationPolicyViolationException e ) { handlePolicyViolation ( getNotification ( ) . getPolicy ( ) , getAttempt ( ) ) ; } catch ( Exception e ) { log . debug ( "Failed to cleanup notification " + attempt . getNotificationId ( ) + " after attempt " + attempt . getUuid ( ) + ". Attempt will be preserved in the failed notification queue." ) ; saveFailedAttempt ( attempt ) ; } }
Handles cleanup after a {@link NotificationAttempt} fails to
 deliver its message.
Handles cleanup after a { @link NotificationAttempt } fails to deliver its message .
// calculate the next runttime // figure out the next time it should run based on the retry policy // increment the number of attempts // set the next scheduled attempt time. // attempt violated policy. don't reschedule, handle directly // err on the side of caution and write the attempt to the failed notificaiton queue