Skip to content

Commit

Permalink
[FLINK-3485][core] implement toString for SerializedListAccumulator
Browse files Browse the repository at this point in the history
The change improves the display of SerializedListAccumulators in the web
interface by displaying the number of elements contained in the
accumulator instead of the hash code of the object.

This closes apache#1717.
  • Loading branch information
mxm authored and subhankar committed Mar 17, 2016
1 parent 1df6cba commit f51eef2
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ public class SerializedListAccumulator<T> implements Accumulator<T, ArrayList<by

private static final long serialVersionUID = 1L;

private ArrayList<byte[]> localValue = new ArrayList<byte[]>();
private ArrayList<byte[]> localValue = new ArrayList<>();


@Override
public void add(T value) {
throw new UnsupportedOperationException();
}

public void add(T value, TypeSerializer<T> serializer) throws IOException {
try {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
Expand Down Expand Up @@ -97,4 +97,9 @@ public static <T> List<T> deserializeList(ArrayList<byte[]> data, TypeSerializer
}
return result;
}

@Override
public String toString() {
return "SerializedListAccumulator: " + localValue.size() + " elements";
}
}

0 comments on commit f51eef2

Please sign in to comment.