@Override public void alreadyAcknowledged() { notificationFinder.failedToProcess(notification, TxResult.AACKED); notificationProcessor.notificationProcessed(notification); }
@Override public void commitFailed(String msg) { notificationProcessor.requeueNotification(notificationFinder, notification); } }
@Override public void close() { tracker.finishAddingNotifications(id); } }
public void requeueNotification(final NotificationFinder notificationFinder, final Notification notification) { WorkTaskAsync workTask = new WorkTaskAsync(this, notificationFinder, env, notification, observers); FutureTask<?> ft = new FutureNotificationTask(notification, notificationFinder, workTask); if (tracker.requeue(notification.getRowColumn(), ft)) { try { executor.execute(ft); } catch (RejectedExecutionException rje) { tracker.remove(notification.getRowColumn()); throw rje; } } }
@Override public void run() { try { // Its possible that while the notification was in the queue the situation changed and it // should no longer be processed by this worker. So ask as late as possible if this // notification should be processed. if (notificationFinder.shouldProcess(notification)) { workTask.run(); } else { notificationProcessed(notification); } } catch (Exception e) { log.error("Failed to process work " + Hex.encNonAscii(notification), e); } }
/** * Starts a session for adding notifications. During this session, any notifications that are * deleted and match the predicate will be remembered. These remembered notifications can not be * added again while the session is active. */ public Session beginAddingNotifications(Predicate<RowColumn> memoryPredicate) { return new Session(memoryPredicate); }
@Override public void committed() { notificationProcessor.notificationProcessed(notification); }
public FutureNotificationTask(Notification n, NotificationFinder nf, WorkTaskAsync wt) { super(new NotificationProcessingTask(n, nf, wt), null); this.notification = n; }
public Session(Predicate<RowColumn> memoryPredicate) { this.id = tracker.beginAddingNotifications(memoryPredicate); }
public void requeueNotification(final NotificationFinder notificationFinder, final Notification notification) { WorkTaskAsync workTask = new WorkTaskAsync(this, notificationFinder, env, notification, observers); FutureTask<?> ft = new FutureNotificationTask(notification, notificationFinder, workTask); if (tracker.requeue(notification.getRowColumn(), ft)) { try { executor.execute(ft); } catch (RejectedExecutionException rje) { tracker.remove(notification.getRowColumn()); throw rje; } } }
@Override public void run() { try { // Its possible that while the notification was in the queue the situation changed and it // should no longer be processed by this worker. So ask as late as possible if this // notification should be processed. if (notificationFinder.shouldProcess(notification)) { workTask.run(); } else { notificationProcessed(notification); } } catch (Exception e) { log.error("Failed to process work " + Hex.encNonAscii(notification), e); } }
@Override public void alreadyAcknowledged() { notificationFinder.failedToProcess(notification, TxResult.AACKED); notificationProcessor.notificationProcessed(notification); }
@Override public void commitFailed(String msg) { notificationProcessor.requeueNotification(notificationFinder, notification); } }
@Override public void close() { tracker.finishAddingNotifications(id); } }
/** * Starts a session for adding notifications. During this session, any notifications that are * deleted and match the predicate will be remembered. These remembered notifications can not be * added again while the session is active. */ public Session beginAddingNotifications(Predicate<RowColumn> memoryPredicate) { return new Session(memoryPredicate); }
@Override public void committed() { notificationProcessor.notificationProcessed(notification); }
public FutureNotificationTask(Notification n, NotificationFinder nf, WorkTaskAsync wt) { super(new NotificationProcessingTask(n, nf, wt), null); this.notification = n; }
public Session(Predicate<RowColumn> memoryPredicate) { this.id = tracker.beginAddingNotifications(memoryPredicate); }
@Override public void failed(Throwable t) { notificationFinder.failedToProcess(notification, TxResult.ERROR); notificationProcessor.notificationProcessed(notification); log.error("Failed to process work " + Hex.encNonAscii(notification), t); }
@Override public void failed(Throwable t) { notificationFinder.failedToProcess(notification, TxResult.ERROR); notificationProcessor.notificationProcessed(notification); log.error("Failed to process work " + Hex.encNonAscii(notification), t); }