@Override public synchronized void accept(T tuple) { for (Consumer<T> subscriber : subscribers) subscriber.accept(tuple); }
@Override public synchronized void accept(T tuple) { for (Consumer<T> subscriber : subscribers) subscriber.accept(tuple); }
@Override protected void peek(T tuple) { peeker.accept(tuple); }
@Override protected void peek(T tuple) { peeker.accept(tuple); }
/** * Create a {@code Runnable} that calls * {@code consumer.accept(value)} when {@code run()} is called. * This can be used to delay the execution of the consumer * until some time in the future using an executor service. * * @param <T> tuple type * @param consumer Function to be applied to {@code value}. * @param value Value to be consumed. * * @return {@code Runnable} that invokes {@code consumer.accept(value)}. */ public static <T> Runnable delayedConsume(Consumer<T> consumer, T value) { return () -> consumer.accept(value); }
/** * Create a {@code Runnable} that calls * {@code consumer.accept(value)} when {@code run()} is called. * This can be used to delay the execution of the consumer * until some time in the future using an executor service. * * @param <T> tuple type * @param consumer Function to be applied to {@code value}. * @param value Value to be consumed. * * @return {@code Runnable} that invokes {@code consumer.accept(value)}. */ public static <T> Runnable delayedConsume(Consumer<T> consumer, T value) { return () -> consumer.accept(value); }
@Override public void accept(T tuple) { for (int i = 0; i < n; i++) targets.get(i).accept(tuple); }
@Override public void accept(T tuple) { for (int i = 0; i < n; i++) targets.get(i).accept(tuple); }
private static void setConfig(Properties p, String name, Consumer<String> setter) { try { String value = p.getProperty(name); if (value != null) { setter.accept(value); } } catch (Exception e) { throw new IllegalArgumentException(name, e); } }
@Override public void accept(T tuple) { int s = splitter.applyAsInt(tuple); if (s >= 0) destinations.get(s % n).accept(tuple); }
/** * Submit a tuple to single output. * @param tuple Tuple to be submitted. */ protected void submit(U tuple) { getDestination().accept(tuple); }
@Override public void accept(T value) { final Consumer<T> function = f(); synchronized (function) { function.accept(value); } } }
/** * Submit a tuple to single output. * @param tuple Tuple to be submitted. */ protected void submit(O tuple) { getDestination().accept(tuple); } }
private void post(String pathname, Exception e, Consumer<String> dst) { String postStr = postFn.apply(pathname, e); if (postStr != null) dst.accept(postStr); }
/** * Submit a tuple to single output. * @param tuple Tuple to be submitted. */ protected void submit(U tuple) { getDestination().accept(tuple); }
@Override public void processCommand(Command cmd) { if (externalCallbackHandler != null) { externalCallbackHandler.processCommand(cmd); } tupleSubmitter.accept(cmd); }
@Override public void accept(T tuple) { int s = splitter.applyAsInt(tuple); if (s >= 0) destinations.get(s % n).accept(tuple); }
@Override public void accept(T value) { final Consumer<T> function = f(); synchronized (function) { function.accept(value); } } }
/** * Submit a tuple to single output. * @param tuple Tuple to be submitted. */ protected void submit(T tuple) { getDestination().accept(tuple); }
@Override public synchronized void evict() { Consumer<Partition<T, K, L>> evictDeterminer = window.getEvictDeterminer(); evictDeterminer.accept(this); } }