Surrender control of input and output streams. #14

Merged
merged 2 commits into from Jul 19, 2012

Projects

None yet

2 participants

@sritchie
Cascading member

Kryo relinquishes control! Hadoop for the win!

@johnynek johnynek commented on an outdated diff Jul 19, 2012
src/jvm/cascading/kryo/KryoSerializer.java
@@ -20,13 +21,28 @@ public KryoSerializer(KryoSerialization kryoSerialization) {
public void open(OutputStream out) throws IOException {
kryo = kryoSerialization.populatedKryo();
- output = new Output(KryoSerialization.OUTPUT_BUFFER_SIZE, KryoSerialization.MAX_OUTPUT_BUFFER_SIZE);
- output.setOutputStream(out);
+
+ if( out instanceof DataOutputStream)
+ outputStream = (DataOutputStream) out;
+ else
+ outputStream = new DataOutputStream(out);
+ }
+
+ // This is to prevent output from maintaining a giant internal buffer.
+ public void tidyBuffer() {
+ if (output.position() > KryoSerialization.SWITCH_LIMIT)
@johnynek
johnynek Jul 19, 2012

This should be <.

@johnynek johnynek merged commit 735ab56 into develop Jul 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment