/** * Invokes all the registered cleaners in the context of the specified * job and element. * * @param jobId The job identifier. * @param elementId The element identifier. */ public void cleanOplet(String jobId, String elementId) { for (BiConsumer<String,String> cleaner : cleaners) cleaner.accept(jobId, elementId); } }
/** * Invokes all the registered cleaners in the context of the specified * job and element. * * @param jobId The job identifier. * @param elementId The element identifier. */ public void cleanOplet(String jobId, String elementId) { for (BiConsumer<String,String> cleaner : cleaners) cleaner.accept(jobId, elementId); } }
private void onEvent(T event, O job) { for (BiConsumer<T, O> listener : listeners) { try { listener.accept(event, job); } catch (Exception e) { logger.error("Exception caught while invoking listener:" + e); } } } }
@Override public void uncaughtException(Thread thread, Throwable throwable) { try { if (!trackedThreadUncaughtException(thread, throwable)) Thread.getDefaultUncaughtExceptionHandler().uncaughtException(thread, throwable); } finally { threads.removeRunning(Thread.currentThread()); completer.accept(this, throwable); } }}; }
@Override public synchronized void process() { window.getPartitionProcessor().accept(unmodifiableTuples, key); }
@Override public void uncaughtException(Thread thread, Throwable throwable) { try { if (!trackedThreadUncaughtException(thread, throwable)) Thread.getDefaultUncaughtExceptionHandler().uncaughtException(thread, throwable); } finally { threads.removeRunning(Thread.currentThread()); completer.accept(this, throwable); } }}; }
@Override public void addListener(BiConsumer<JobRegistryService.EventType, Job> listener) { listeners.add(listener); synchronized (jobs) { for (Job job : jobs.values()) listener.accept(JobRegistryService.EventType.ADD, job); } }
@Override public synchronized void process() { window.getPartitionProcessor().accept(unmodifiableTuples, key); }
/** * Remove tracking of the task and notify the completer if * the scheduler seems to have no work. */ private void removeTrack() { synchronized(asyncTasks) { asyncTasks.remove(this); } // see cancelAllAsyncTasks // Notify the completer if the following is true: // no asyncTasks (user tasks) pending, or the executor's task // queue is empty and the number of active threads includes // only the current one. if (asyncTasks.isEmpty() || (getActiveCount() <= 1 && getQueue().isEmpty())) { completer.accept(TrackingScheduledExecutor.this, null); } }
/** * Remove tracking of the task and notify the completer if * the scheduler seems to have no work. */ private void removeTrack() { synchronized(asyncTasks) { asyncTasks.remove(this); } // see cancelAllAsyncTasks // Notify the completer if the following is true: // no asyncTasks (user tasks) pending, or the executor's task // queue is empty and the number of active threads includes // only the current one. if (asyncTasks.isEmpty() || (getActiveCount() <= 1 && getQueue().isEmpty())) { completer.accept(TrackingScheduledExecutor.this, null); } }
/** * Keep track of non-daemon threads so shutdown can wait for * their termination. */ @Override public void run() { threads.fromNewToRunning(Thread.currentThread()); r.run(); /* If the task has thrown an exception, the code below is * not getting executed. The uncaughtException this.handler * removes the thread from the tracker list and notifies * the completer. */ threads.removeRunning(Thread.currentThread()); if (!hasActiveNonDaemonThreads()) completer.accept(ThreadFactoryTracker.this, null); } };
/** * Keep track of non-daemon threads so shutdown can wait for * their termination. */ @Override public void run() { threads.fromNewToRunning(Thread.currentThread()); r.run(); /* If the task has thrown an exception, the code below is * not getting executed. The uncaughtException this.handler * removes the thread from the tracker list and notifies * the completer. */ threads.removeRunning(Thread.currentThread()); if (!hasActiveNonDaemonThreads()) completer.accept(ThreadFactoryTracker.this, null); } };
builder.accept(topology, config);
/** * Invoked by the super class after each task execution. */ @Override protected void afterExecute(Runnable r, Throwable t) { super.afterExecute(r, t); if (t == null && r instanceof Future<?>) { t = unwrapFutureThrowable((Future<?>) r); } if (t != null) { getLogger().error("Thread: " + Thread.currentThread().getName() + ": task terminated with exception : ", t); cleanup(); completer.accept(this, t); } }
builder.accept(topology, config);
/** * Invoked by the super class after each task execution. */ @Override protected void afterExecute(Runnable r, Throwable t) { super.afterExecute(r, t); if (t == null && r instanceof Future<?>) { t = unwrapFutureThrowable((Future<?>) r); } if (t != null) { getLogger().error("Thread: " + Thread.currentThread().getName() + ": task terminated with exception : ", t); cleanup(); completer.accept(this, t); } }
(topology,cfg) -> builder.accept(IotDevicePubSub.addIotDevice(topology), cfg)); if (autoSubmit) { autoSubmitApps.put(applicationName, config);
(topology,cfg) -> builder.accept(IotDevicePubSub.addIotDevice(topology), cfg)); if (autoSubmit) { autoSubmitApps.put(applicationName, config);