@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); } }
public boolean addNotification(final NotificationFinder notificationFinder, final Notification notification) { WorkTaskAsync workTask = new WorkTaskAsync(NotificationProcessor.this, notificationFinder, env, notification, observers); FutureTask<?> ft = new FutureNotificationTask(notification, notificationFinder, workTask); if (!tracker.add(notification.getRowColumn(), ft)) { return false; } try { executor.execute(ft); } catch (RejectedExecutionException rje) { tracker.remove(notification.getRowColumn()); throw rje; } return true; }
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; } } }
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); } }
public boolean addNotification(final NotificationFinder notificationFinder, final Notification notification) { WorkTaskAsync workTask = new WorkTaskAsync(NotificationProcessor.this, notificationFinder, env, notification, observers); FutureTask<?> ft = new FutureNotificationTask(notification, notificationFinder, workTask); if (!tracker.add(notification.getRowColumn(), ft)) { return false; } try { executor.execute(ft); } catch (RejectedExecutionException rje) { tracker.remove(notification.getRowColumn()); throw rje; } return true; }