Switched KryoNamespace internal buffer to ByteBufferOutput
Change-Id: Iee3738bf0133440f4b6e695b9b92a9a2c8cc202f
Showing
1 changed file
with
2 additions
and
2 deletions
... | @@ -27,7 +27,6 @@ import com.esotericsoftware.kryo.Serializer; | ... | @@ -27,7 +27,6 @@ import com.esotericsoftware.kryo.Serializer; |
27 | import com.esotericsoftware.kryo.io.ByteBufferInput; | 27 | import com.esotericsoftware.kryo.io.ByteBufferInput; |
28 | import com.esotericsoftware.kryo.io.ByteBufferOutput; | 28 | import com.esotericsoftware.kryo.io.ByteBufferOutput; |
29 | import com.esotericsoftware.kryo.io.Input; | 29 | import com.esotericsoftware.kryo.io.Input; |
30 | -import com.esotericsoftware.kryo.io.Output; | ||
31 | import com.esotericsoftware.kryo.pool.KryoFactory; | 30 | import com.esotericsoftware.kryo.pool.KryoFactory; |
32 | import com.google.common.collect.ImmutableList; | 31 | import com.google.common.collect.ImmutableList; |
33 | 32 | ||
... | @@ -44,6 +43,7 @@ public final class KryoNamespace implements KryoFactory { | ... | @@ -44,6 +43,7 @@ public final class KryoNamespace implements KryoFactory { |
44 | * @see #serialize(Object) | 43 | * @see #serialize(Object) |
45 | */ | 44 | */ |
46 | public static final int DEFAULT_BUFFER_SIZE = 1 * 1000 * 1000; | 45 | public static final int DEFAULT_BUFFER_SIZE = 1 * 1000 * 1000; |
46 | + public static final int MAX_BUFFER_SIZE = 100 * 1000 * 1000; | ||
47 | 47 | ||
48 | private final ConcurrentLinkedQueue<Kryo> pool = new ConcurrentLinkedQueue<>(); | 48 | private final ConcurrentLinkedQueue<Kryo> pool = new ConcurrentLinkedQueue<>(); |
49 | private final ImmutableList<Pair<Class<?>, Serializer<?>>> registeredTypes; | 49 | private final ImmutableList<Pair<Class<?>, Serializer<?>>> registeredTypes; |
... | @@ -188,7 +188,7 @@ public final class KryoNamespace implements KryoFactory { | ... | @@ -188,7 +188,7 @@ public final class KryoNamespace implements KryoFactory { |
188 | * @return serialized bytes | 188 | * @return serialized bytes |
189 | */ | 189 | */ |
190 | public byte[] serialize(final Object obj, final int bufferSize) { | 190 | public byte[] serialize(final Object obj, final int bufferSize) { |
191 | - Output out = new Output(bufferSize); | 191 | + ByteBufferOutput out = new ByteBufferOutput(bufferSize, MAX_BUFFER_SIZE); |
192 | Kryo kryo = getKryo(); | 192 | Kryo kryo = getKryo(); |
193 | try { | 193 | try { |
194 | kryo.writeClassAndObject(out, obj); | 194 | kryo.writeClassAndObject(out, obj); | ... | ... |
-
Please register or login to post a comment