Skip to content

Instantly share code, notes, and snippets.

View RoryKelly's full-sized avatar

Rory Kelly RoryKelly

View GitHub Profile
@RoryKelly
RoryKelly / MirroredSource.java
Last active February 7, 2018 07:58
Mirrored Source for OKIO.
/**
* Takes a bytes source and streams it to parallel sources. I.E Streaming bytes to two server in parallel.
*/
public final class MirroredSource {
private final Buffer buffer = new Buffer();
private final Source source;
private final AtomicBoolean sourceExhausted = new AtomicBoolean();
private boolean closed = false;