/** * Helper method to execute a two-sink change source. * * @param multiSink the twp-sink change source to run. * @param source1 the first source to feed to the sink. * @param source2 the second source to feed to the sink. * @param exceptionHandler the exception handler to attach to threads. * @return the sink change inspector containing the result. * @throws Exception if something goes wrong. */ public static SinkChangeInspector run(MultiSinkRunnableChangeSource multiSink, RunnableSource source1, RunnableSource source2, Thread.UncaughtExceptionHandler exceptionHandler) throws Exception { SinkChangeInspector inspector = new SinkChangeInspector(); source1.setSink(multiSink.getSink(0)); source2.setSink(multiSink.getSink(1)); multiSink.setChangeSink(inspector); runCore(multiSink, source1, source2, exceptionHandler); return inspector; }
/** * {@inheritDoc} */ @Override public void connect(PipeTasks pipeTasks) { // A multi sink receives multiple streams of data, so we must connect // them up one by one. for (int i = 0; i < task.getSinkCount(); i++) { Sink sink; Source source; // Retrieve the next sink. sink = task.getSink(i); // Retrieve the appropriate source. source = (Source) getInputTask(pipeTasks, i, Source.class); // Connect the tasks. source.setSink(sink); } // Register the change source as an output task. setOutputTask(pipeTasks, task, 0); }
/** * {@inheritDoc} */ @Override public void connect(PipeTasks pipeTasks) { // A multi sink receives multiple streams of data, so we must connect // them up one by one. for (int i = 0; i < task.getSinkCount(); i++) { Sink sink; Source source; // Retrieve the next sink. sink = task.getSink(i); // Retrieve the appropriate source. source = (Source) getInputTask(pipeTasks, i, Source.class); // Connect the tasks. source.setSink(sink); } // Register the change source as an output task. setOutputTask(pipeTasks, task, 0); }
/** * Helper method to execute a two-sink change source. * * @param multiSink the twp-sink change source to run. * @param source1 the first source to feed to the sink. * @param source2 the second source to feed to the sink. * @param exceptionHandler the exception handler to attach to threads. * @return the sink change inspector containing the result. * @throws Exception if something goes wrong. */ public static SinkChangeInspector run(MultiSinkRunnableChangeSource multiSink, RunnableSource source1, RunnableSource source2, Thread.UncaughtExceptionHandler exceptionHandler) throws Exception { SinkChangeInspector inspector = new SinkChangeInspector(); source1.setSink(multiSink.getSink(0)); source2.setSink(multiSink.getSink(1)); multiSink.setChangeSink(inspector); runCore(multiSink, source1, source2, exceptionHandler); return inspector; }