@Override public void committed() { notificationProcessor.notificationProcessed(notification); }
@Override public void commitFailed(String msg) { notificationProcessor.requeueNotification(notificationFinder, notification); } }
@Override public void stop() { try { notificationFinder.stop(); np.close(); appIdCache.close(); reporters.close(); env.close(); } catch (Exception e) { throw new FluoException(e); } }
@Override public void start() { try { env = new Environment(config); reporters = ReporterUtil.setupReporters(env); appIdCache = CuratorUtil.startAppIdWatcher(env); log.info("Starting Worker for Fluo '{}' application with the following configuration:", config.getApplicationName()); env.getConfiguration().print(); np = new NotificationProcessor(env); notificationFinder = NotificationFinderFactory.newNotificationFinder(env.getConfiguration()); notificationFinder.init(env, np); notificationFinder.start(); } catch (Exception e) { throw new FluoException(e); } }
Set<TableRange> rangeSet = new HashSet<>(); int qSize = proccessor.size(); PartitionInfo partition = partitionManager.waitForPartitionInfo(); while (proccessor.size() > qSize / 2 && !stopped.get()) { UtilWaitThread.sleep(50, stopped); if (partition.equals(pi)) { try (Session session = proccessor.beginAddingNotifications(rc -> tabletRange.contains(rc.getRow()))) { qSize = proccessor.size();
@Override public void close() { try { if (oserver != null) { notificationFinder.stop(); mnp.close(); oserver.stop(); env.close(); reporter.close(); if (cluster != null) { cluster.stop(); } } } catch (Exception e) { throw new RuntimeException(e); } }
@Override public void start() { try { env = new Environment(config); reporters = ReporterUtil.setupReporters(env); appIdCache = CuratorUtil.startAppIdWatcher(env); log.info("Starting Worker for Fluo '{}' application with the following configuration:", config.getApplicationName()); env.getConfiguration().print(); np = new NotificationProcessor(env); notificationFinder = NotificationFinderFactory.newNotificationFinder(env.getConfiguration()); notificationFinder.init(env, np); notificationFinder.start(); } catch (Exception e) { throw new FluoException(e); } }
Set<TableRange> rangeSet = new HashSet<>(); int qSize = proccessor.size(); while (proccessor.size() > qSize / 2 && !stopped.get()) { UtilWaitThread.sleep(50, stopped); if (partition.equals(pi)) { try (Session session = proccessor.beginAddingNotifications(rc -> tabletRange.contains(rc.getRow()))) { qSize = proccessor.size();
@Override public void stop() { try { notificationFinder.stop(); np.close(); appIdCache.close(); reporters.close(); env.close(); } catch (Exception e) { throw new FluoException(e); } }
public MiniFluoImpl(FluoConfiguration fluoConfig) { if (!fluoConfig.hasRequiredMiniFluoProps()) { throw new IllegalArgumentException("MiniFluo configuration is not valid"); } config = fluoConfig; try { if (config.getMiniStartAccumulo()) { startMiniAccumulo(); } config.setProperty(FluoConfigurationImpl.NTFY_FINDER_MIN_SLEEP_TIME_PROP, 50); config.setProperty(FluoConfigurationImpl.NTFY_FINDER_MAX_SLEEP_TIME_PROP, 100); env = new Environment(config); reporter = FluoClientImpl.setupReporters(env, "mini", reporterCounter); oserver = new OracleServer(env); oserver.start(); mnp = new NotificationProcessor(env); notificationFinder = NotificationFinderFactory.newNotificationFinder(env.getConfiguration()); notificationFinder.init(env, mnp); notificationFinder.start(); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public void committed() { notificationProcessor.notificationProcessed(notification); }
@Override public void commitFailed(String msg) { notificationProcessor.requeueNotification(notificationFinder, notification); } }
@Override public void close() { try { if (oserver != null) { notificationFinder.stop(); mnp.close(); oserver.stop(); env.close(); reporter.close(); if (cluster != null) { cluster.stop(); } } } catch (Exception e) { throw new RuntimeException(e); } }
public MiniFluoImpl(FluoConfiguration fluoConfig) { if (!fluoConfig.hasRequiredMiniFluoProps()) { throw new IllegalArgumentException("MiniFluo configuration is not valid"); } config = fluoConfig; try { if (config.getMiniStartAccumulo()) { startMiniAccumulo(); } config.setProperty(FluoConfigurationImpl.NTFY_FINDER_MIN_SLEEP_TIME_PROP, 50); config.setProperty(FluoConfigurationImpl.NTFY_FINDER_MAX_SLEEP_TIME_PROP, 100); env = new Environment(config); reporter = FluoClientImpl.setupReporters(env, "mini", reporterCounter); oserver = new OracleServer(env); oserver.start(); mnp = new NotificationProcessor(env); notificationFinder = NotificationFinderFactory.newNotificationFinder(env.getConfiguration()); notificationFinder.init(env, mnp); notificationFinder.start(); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public void alreadyAcknowledged() { notificationFinder.failedToProcess(notification, TxResult.AACKED); notificationProcessor.notificationProcessed(notification); }
@Override public void alreadyAcknowledged() { notificationFinder.failedToProcess(notification, TxResult.AACKED); notificationProcessor.notificationProcessed(notification); }
@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); }
@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 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); } }