/** * Closes the writer. This stops the flushing thread (if there is one). */ public void close() { clearBuffers(); // make sure we terminate the thread in any case if (outputFlusher != null) { outputFlusher.terminate(); try { outputFlusher.join(); } catch (InterruptedException e) { // ignore on close // restore interrupt flag to fast exit further blocking calls Thread.currentThread().interrupt(); } } }
public StreamRecordWriter( ResultPartitionWriter writer, ChannelSelector<T> channelSelector, long timeout, String taskName) { super(writer, channelSelector, timeout == 0); checkArgument(timeout >= -1); if (timeout == -1) { outputFlusher = null; } else if (timeout == 0) { outputFlusher = null; } else { String threadName = taskName == null ? DEFAULT_OUTPUT_FLUSH_THREAD_NAME : DEFAULT_OUTPUT_FLUSH_THREAD_NAME + " for " + taskName; outputFlusher = new OutputFlusher(threadName, timeout); outputFlusher.start(); } }
public StreamRecordWriter( ResultPartitionWriter writer, ChannelSelector<T> channelSelector, long timeout, String taskName) { super(writer, channelSelector, timeout == 0); checkArgument(timeout >= -1); if (timeout == -1) { outputFlusher = null; } else if (timeout == 0) { outputFlusher = null; } else { String threadName = taskName == null ? DEFAULT_OUTPUT_FLUSH_THREAD_NAME : DEFAULT_OUTPUT_FLUSH_THREAD_NAME + " for " + taskName; outputFlusher = new OutputFlusher(threadName, timeout); outputFlusher.start(); } }
public StreamRecordWriter(ResultPartitionWriter writer, ChannelSelector<T> channelSelector, long timeout, String taskName) { super(writer, channelSelector); checkArgument(timeout >= -1); if (timeout == -1) { flushAlways = false; outputFlusher = null; } else if (timeout == 0) { flushAlways = true; outputFlusher = null; } else { flushAlways = false; String threadName = taskName == null ? DEFAULT_OUTPUT_FLUSH_THREAD_NAME : "Output Timeout Flusher - " + taskName; outputFlusher = new OutputFlusher(threadName, timeout); outputFlusher.start(); } }
/** * Closes the writer. This stops the flushing thread (if there is one). */ public void close() { clearBuffers(); // make sure we terminate the thread in any case if (outputFlusher != null) { outputFlusher.terminate(); try { outputFlusher.join(); } catch (InterruptedException e) { // ignore on close // restore interrupt flag to fast exit further blocking calls Thread.currentThread().interrupt(); } } }