Yuta HIGUCHI

Rename KryoPool -> KryoNamespace

Change-Id: Ife1c311b40eaab133bb3b8dd3314b98c60b4411d
Showing 18 changed files with 59 additions and 59 deletions
...@@ -23,10 +23,10 @@ import org.onlab.onos.store.cluster.messaging.ClusterMessageHandler; ...@@ -23,10 +23,10 @@ import org.onlab.onos.store.cluster.messaging.ClusterMessageHandler;
23 import org.onlab.onos.store.cluster.messaging.ClusterMessageResponse; 23 import org.onlab.onos.store.cluster.messaging.ClusterMessageResponse;
24 import org.onlab.onos.store.cluster.messaging.MessageSubject; 24 import org.onlab.onos.store.cluster.messaging.MessageSubject;
25 import org.onlab.onos.store.serializers.ClusterMessageSerializer; 25 import org.onlab.onos.store.serializers.ClusterMessageSerializer;
26 -import org.onlab.onos.store.serializers.KryoPoolUtil; 26 +import org.onlab.onos.store.serializers.KryoNamespaces;
27 import org.onlab.onos.store.serializers.KryoSerializer; 27 import org.onlab.onos.store.serializers.KryoSerializer;
28 import org.onlab.onos.store.serializers.MessageSubjectSerializer; 28 import org.onlab.onos.store.serializers.MessageSubjectSerializer;
29 -import org.onlab.util.KryoPool; 29 +import org.onlab.util.KryoNamespace;
30 import org.onlab.netty.Endpoint; 30 import org.onlab.netty.Endpoint;
31 import org.onlab.netty.Message; 31 import org.onlab.netty.Message;
32 import org.onlab.netty.MessageHandler; 32 import org.onlab.netty.MessageHandler;
...@@ -52,8 +52,8 @@ public class ClusterCommunicationManager ...@@ -52,8 +52,8 @@ public class ClusterCommunicationManager
52 private static final KryoSerializer SERIALIZER = new KryoSerializer() { 52 private static final KryoSerializer SERIALIZER = new KryoSerializer() {
53 @Override 53 @Override
54 protected void setupKryoPool() { 54 protected void setupKryoPool() {
55 - serializerPool = KryoPool.newBuilder() 55 + serializerPool = KryoNamespace.newBuilder()
56 - .register(KryoPoolUtil.API) 56 + .register(KryoNamespaces.API)
57 .register(ClusterMessage.class, new ClusterMessageSerializer()) 57 .register(ClusterMessage.class, new ClusterMessageSerializer())
58 .register(ClusterMembershipEvent.class) 58 .register(ClusterMembershipEvent.class)
59 .register(byte[].class) 59 .register(byte[].class)
......
...@@ -42,7 +42,7 @@ import org.onlab.onos.store.impl.Timestamped; ...@@ -42,7 +42,7 @@ import org.onlab.onos.store.impl.Timestamped;
42 import org.onlab.onos.store.serializers.KryoSerializer; 42 import org.onlab.onos.store.serializers.KryoSerializer;
43 import org.onlab.onos.store.serializers.DistributedStoreSerializers; 43 import org.onlab.onos.store.serializers.DistributedStoreSerializers;
44 import org.onlab.packet.ChassisId; 44 import org.onlab.packet.ChassisId;
45 -import org.onlab.util.KryoPool; 45 +import org.onlab.util.KryoNamespace;
46 import org.onlab.util.NewConcurrentHashMap; 46 import org.onlab.util.NewConcurrentHashMap;
47 import org.slf4j.Logger; 47 import org.slf4j.Logger;
48 48
...@@ -117,7 +117,7 @@ public class GossipDeviceStore ...@@ -117,7 +117,7 @@ public class GossipDeviceStore
117 protected static final KryoSerializer SERIALIZER = new KryoSerializer() { 117 protected static final KryoSerializer SERIALIZER = new KryoSerializer() {
118 @Override 118 @Override
119 protected void setupKryoPool() { 119 protected void setupKryoPool() {
120 - serializerPool = KryoPool.newBuilder() 120 + serializerPool = KryoNamespace.newBuilder()
121 .register(DistributedStoreSerializers.COMMON) 121 .register(DistributedStoreSerializers.COMMON)
122 122
123 .register(InternalDeviceEvent.class, new InternalDeviceEventSerializer()) 123 .register(InternalDeviceEvent.class, new InternalDeviceEventSerializer())
......
...@@ -35,7 +35,7 @@ import org.onlab.onos.store.flow.ReplicaInfo; ...@@ -35,7 +35,7 @@ import org.onlab.onos.store.flow.ReplicaInfo;
35 import org.onlab.onos.store.flow.ReplicaInfoService; 35 import org.onlab.onos.store.flow.ReplicaInfoService;
36 import org.onlab.onos.store.serializers.DistributedStoreSerializers; 36 import org.onlab.onos.store.serializers.DistributedStoreSerializers;
37 import org.onlab.onos.store.serializers.KryoSerializer; 37 import org.onlab.onos.store.serializers.KryoSerializer;
38 -import org.onlab.util.KryoPool; 38 +import org.onlab.util.KryoNamespace;
39 import org.slf4j.Logger; 39 import org.slf4j.Logger;
40 40
41 import com.google.common.collect.ArrayListMultimap; 41 import com.google.common.collect.ArrayListMultimap;
...@@ -72,7 +72,7 @@ public class DistributedFlowRuleStore ...@@ -72,7 +72,7 @@ public class DistributedFlowRuleStore
72 protected static final KryoSerializer SERIALIZER = new KryoSerializer() { 72 protected static final KryoSerializer SERIALIZER = new KryoSerializer() {
73 @Override 73 @Override
74 protected void setupKryoPool() { 74 protected void setupKryoPool() {
75 - serializerPool = KryoPool.newBuilder() 75 + serializerPool = KryoNamespace.newBuilder()
76 .register(DistributedStoreSerializers.COMMON) 76 .register(DistributedStoreSerializers.COMMON)
77 .build() 77 .build()
78 .populate(1); 78 .populate(1);
......
...@@ -44,7 +44,7 @@ import org.onlab.onos.store.serializers.KryoSerializer; ...@@ -44,7 +44,7 @@ import org.onlab.onos.store.serializers.KryoSerializer;
44 import org.onlab.packet.IpPrefix; 44 import org.onlab.packet.IpPrefix;
45 import org.onlab.packet.MacAddress; 45 import org.onlab.packet.MacAddress;
46 import org.onlab.packet.VlanId; 46 import org.onlab.packet.VlanId;
47 -import org.onlab.util.KryoPool; 47 +import org.onlab.util.KryoNamespace;
48 import org.slf4j.Logger; 48 import org.slf4j.Logger;
49 49
50 import java.io.IOException; 50 import java.io.IOException;
...@@ -99,7 +99,7 @@ public class GossipHostStore ...@@ -99,7 +99,7 @@ public class GossipHostStore
99 private static final KryoSerializer SERIALIZER = new KryoSerializer() { 99 private static final KryoSerializer SERIALIZER = new KryoSerializer() {
100 @Override 100 @Override
101 protected void setupKryoPool() { 101 protected void setupKryoPool() {
102 - serializerPool = KryoPool.newBuilder() 102 + serializerPool = KryoNamespace.newBuilder()
103 .register(DistributedStoreSerializers.COMMON) 103 .register(DistributedStoreSerializers.COMMON)
104 .register(InternalHostEvent.class) 104 .register(InternalHostEvent.class)
105 .register(InternalHostRemovedEvent.class) 105 .register(InternalHostRemovedEvent.class)
......
...@@ -42,7 +42,7 @@ import org.onlab.onos.store.cluster.messaging.MessageSubject; ...@@ -42,7 +42,7 @@ import org.onlab.onos.store.cluster.messaging.MessageSubject;
42 import org.onlab.onos.store.impl.Timestamped; 42 import org.onlab.onos.store.impl.Timestamped;
43 import org.onlab.onos.store.serializers.DistributedStoreSerializers; 43 import org.onlab.onos.store.serializers.DistributedStoreSerializers;
44 import org.onlab.onos.store.serializers.KryoSerializer; 44 import org.onlab.onos.store.serializers.KryoSerializer;
45 -import org.onlab.util.KryoPool; 45 +import org.onlab.util.KryoNamespace;
46 import org.slf4j.Logger; 46 import org.slf4j.Logger;
47 47
48 import java.io.IOException; 48 import java.io.IOException;
...@@ -110,7 +110,7 @@ public class GossipLinkStore ...@@ -110,7 +110,7 @@ public class GossipLinkStore
110 private static final KryoSerializer SERIALIZER = new KryoSerializer() { 110 private static final KryoSerializer SERIALIZER = new KryoSerializer() {
111 @Override 111 @Override
112 protected void setupKryoPool() { 112 protected void setupKryoPool() {
113 - serializerPool = KryoPool.newBuilder() 113 + serializerPool = KryoNamespace.newBuilder()
114 .register(DistributedStoreSerializers.COMMON) 114 .register(DistributedStoreSerializers.COMMON)
115 .register(InternalLinkEvent.class) 115 .register(InternalLinkEvent.class)
116 .register(InternalLinkRemovedEvent.class) 116 .register(InternalLinkRemovedEvent.class)
......
...@@ -3,15 +3,15 @@ package org.onlab.onos.store.serializers; ...@@ -3,15 +3,15 @@ package org.onlab.onos.store.serializers;
3 import org.onlab.onos.store.impl.MastershipBasedTimestamp; 3 import org.onlab.onos.store.impl.MastershipBasedTimestamp;
4 import org.onlab.onos.store.impl.Timestamped; 4 import org.onlab.onos.store.impl.Timestamped;
5 import org.onlab.onos.store.impl.WallClockTimestamp; 5 import org.onlab.onos.store.impl.WallClockTimestamp;
6 -import org.onlab.util.KryoPool; 6 +import org.onlab.util.KryoNamespace;
7 7
8 public final class DistributedStoreSerializers { 8 public final class DistributedStoreSerializers {
9 9
10 /** 10 /**
11 - * KryoPool which can serialize ON.lab misc classes. 11 + * KryoNamespace which can serialize ON.lab misc classes.
12 */ 12 */
13 - public static final KryoPool COMMON = KryoPool.newBuilder() 13 + public static final KryoNamespace COMMON = KryoNamespace.newBuilder()
14 - .register(KryoPoolUtil.API) 14 + .register(KryoNamespaces.API)
15 .register(Timestamped.class) 15 .register(Timestamped.class)
16 .register(MastershipBasedTimestamp.class, new MastershipBasedTimestampSerializer()) 16 .register(MastershipBasedTimestamp.class, new MastershipBasedTimestampSerializer())
17 .register(WallClockTimestamp.class) 17 .register(WallClockTimestamp.class)
......
...@@ -7,7 +7,7 @@ import java.nio.ByteBuffer; ...@@ -7,7 +7,7 @@ import java.nio.ByteBuffer;
7 import org.junit.Test; 7 import org.junit.Test;
8 import org.onlab.onos.store.Timestamp; 8 import org.onlab.onos.store.Timestamp;
9 import org.onlab.onos.store.serializers.MastershipBasedTimestampSerializer; 9 import org.onlab.onos.store.serializers.MastershipBasedTimestampSerializer;
10 -import org.onlab.util.KryoPool; 10 +import org.onlab.util.KryoNamespace;
11 11
12 import com.google.common.testing.EqualsTester; 12 import com.google.common.testing.EqualsTester;
13 13
...@@ -63,7 +63,7 @@ public class MastershipBasedTimestampTest { ...@@ -63,7 +63,7 @@ public class MastershipBasedTimestampTest {
63 @Test 63 @Test
64 public final void testKryoSerializable() { 64 public final void testKryoSerializable() {
65 final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024); 65 final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024);
66 - final KryoPool kryos = KryoPool.newBuilder() 66 + final KryoNamespace kryos = KryoNamespace.newBuilder()
67 .register(MastershipBasedTimestamp.class) 67 .register(MastershipBasedTimestamp.class)
68 .build(); 68 .build();
69 69
...@@ -79,7 +79,7 @@ public class MastershipBasedTimestampTest { ...@@ -79,7 +79,7 @@ public class MastershipBasedTimestampTest {
79 @Test 79 @Test
80 public final void testKryoSerializableWithHandcraftedSerializer() { 80 public final void testKryoSerializableWithHandcraftedSerializer() {
81 final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024); 81 final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024);
82 - final KryoPool kryos = KryoPool.newBuilder() 82 + final KryoNamespace kryos = KryoNamespace.newBuilder()
83 .register(MastershipBasedTimestamp.class, new MastershipBasedTimestampSerializer()) 83 .register(MastershipBasedTimestamp.class, new MastershipBasedTimestampSerializer())
84 .build(); 84 .build();
85 85
......
...@@ -6,7 +6,7 @@ import java.nio.ByteBuffer; ...@@ -6,7 +6,7 @@ import java.nio.ByteBuffer;
6 6
7 import org.junit.Test; 7 import org.junit.Test;
8 import org.onlab.onos.store.Timestamp; 8 import org.onlab.onos.store.Timestamp;
9 -import org.onlab.util.KryoPool; 9 +import org.onlab.util.KryoNamespace;
10 10
11 import com.google.common.testing.EqualsTester; 11 import com.google.common.testing.EqualsTester;
12 12
...@@ -77,7 +77,7 @@ public class TimestampedTest { ...@@ -77,7 +77,7 @@ public class TimestampedTest {
77 @Test 77 @Test
78 public final void testKryoSerializable() { 78 public final void testKryoSerializable() {
79 final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024); 79 final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024);
80 - final KryoPool kryos = KryoPool.newBuilder() 80 + final KryoNamespace kryos = KryoNamespace.newBuilder()
81 .register(Timestamped.class, 81 .register(Timestamped.class,
82 MastershipBasedTimestamp.class) 82 MastershipBasedTimestamp.class)
83 .build(); 83 .build();
......
...@@ -6,7 +6,7 @@ import java.nio.ByteBuffer; ...@@ -6,7 +6,7 @@ import java.nio.ByteBuffer;
6 6
7 import org.junit.Test; 7 import org.junit.Test;
8 import org.onlab.onos.store.Timestamp; 8 import org.onlab.onos.store.Timestamp;
9 -import org.onlab.util.KryoPool; 9 +import org.onlab.util.KryoNamespace;
10 10
11 import com.google.common.testing.EqualsTester; 11 import com.google.common.testing.EqualsTester;
12 12
...@@ -30,7 +30,7 @@ public class WallClockTimestampTest { ...@@ -30,7 +30,7 @@ public class WallClockTimestampTest {
30 public final void testKryoSerializable() { 30 public final void testKryoSerializable() {
31 WallClockTimestamp ts1 = new WallClockTimestamp(); 31 WallClockTimestamp ts1 = new WallClockTimestamp();
32 final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024); 32 final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024);
33 - final KryoPool kryos = KryoPool.newBuilder() 33 + final KryoNamespace kryos = KryoNamespace.newBuilder()
34 .register(WallClockTimestamp.class) 34 .register(WallClockTimestamp.class)
35 .build(); 35 .build();
36 36
......
...@@ -24,9 +24,9 @@ import org.onlab.onos.net.DeviceId; ...@@ -24,9 +24,9 @@ import org.onlab.onos.net.DeviceId;
24 import org.onlab.onos.net.MastershipRole; 24 import org.onlab.onos.net.MastershipRole;
25 import org.onlab.onos.store.common.AbstractHazelcastStore; 25 import org.onlab.onos.store.common.AbstractHazelcastStore;
26 import org.onlab.onos.store.common.SMap; 26 import org.onlab.onos.store.common.SMap;
27 -import org.onlab.onos.store.serializers.KryoPoolUtil; 27 +import org.onlab.onos.store.serializers.KryoNamespaces;
28 import org.onlab.onos.store.serializers.KryoSerializer; 28 import org.onlab.onos.store.serializers.KryoSerializer;
29 -import org.onlab.util.KryoPool; 29 +import org.onlab.util.KryoNamespace;
30 30
31 import com.google.common.collect.ImmutableSet; 31 import com.google.common.collect.ImmutableSet;
32 import com.hazelcast.core.EntryEvent; 32 import com.hazelcast.core.EntryEvent;
...@@ -69,8 +69,8 @@ implements MastershipStore { ...@@ -69,8 +69,8 @@ implements MastershipStore {
69 this.serializer = new KryoSerializer() { 69 this.serializer = new KryoSerializer() {
70 @Override 70 @Override
71 protected void setupKryoPool() { 71 protected void setupKryoPool() {
72 - serializerPool = KryoPool.newBuilder() 72 + serializerPool = KryoNamespace.newBuilder()
73 - .register(KryoPoolUtil.API) 73 + .register(KryoNamespaces.API)
74 74
75 .register(RoleValue.class, new RoleValueSerializer()) 75 .register(RoleValue.class, new RoleValueSerializer())
76 .build() 76 .build()
......
1 package org.onlab.onos.store.serializers; 1 package org.onlab.onos.store.serializers;
2 2
3 -import org.onlab.util.KryoPool.FamilySerializer; 3 +import org.onlab.util.KryoNamespace.FamilySerializer;
4 4
5 import com.esotericsoftware.kryo.Kryo; 5 import com.esotericsoftware.kryo.Kryo;
6 import com.esotericsoftware.kryo.io.Input; 6 import com.esotericsoftware.kryo.io.Input;
......
...@@ -4,7 +4,7 @@ import java.util.Collections; ...@@ -4,7 +4,7 @@ import java.util.Collections;
4 import java.util.HashMap; 4 import java.util.HashMap;
5 import java.util.Map; 5 import java.util.Map;
6 6
7 -import org.onlab.util.KryoPool.FamilySerializer; 7 +import org.onlab.util.KryoNamespace.FamilySerializer;
8 8
9 import com.esotericsoftware.kryo.Kryo; 9 import com.esotericsoftware.kryo.Kryo;
10 import com.esotericsoftware.kryo.io.Input; 10 import com.esotericsoftware.kryo.io.Input;
......
...@@ -3,7 +3,7 @@ package org.onlab.onos.store.serializers; ...@@ -3,7 +3,7 @@ package org.onlab.onos.store.serializers;
3 import java.util.ArrayList; 3 import java.util.ArrayList;
4 import java.util.List; 4 import java.util.List;
5 5
6 -import org.onlab.util.KryoPool.FamilySerializer; 6 +import org.onlab.util.KryoNamespace.FamilySerializer;
7 7
8 import com.esotericsoftware.kryo.Kryo; 8 import com.esotericsoftware.kryo.Kryo;
9 import com.esotericsoftware.kryo.io.Input; 9 import com.esotericsoftware.kryo.io.Input;
......
...@@ -36,18 +36,18 @@ import org.onlab.packet.IpAddress; ...@@ -36,18 +36,18 @@ import org.onlab.packet.IpAddress;
36 import org.onlab.packet.IpPrefix; 36 import org.onlab.packet.IpPrefix;
37 import org.onlab.packet.MacAddress; 37 import org.onlab.packet.MacAddress;
38 import org.onlab.packet.VlanId; 38 import org.onlab.packet.VlanId;
39 -import org.onlab.util.KryoPool; 39 +import org.onlab.util.KryoNamespace;
40 40
41 import com.google.common.collect.ImmutableList; 41 import com.google.common.collect.ImmutableList;
42 import com.google.common.collect.ImmutableMap; 42 import com.google.common.collect.ImmutableMap;
43 import com.google.common.collect.ImmutableSet; 43 import com.google.common.collect.ImmutableSet;
44 44
45 -public final class KryoPoolUtil { 45 +public final class KryoNamespaces {
46 46
47 /** 47 /**
48 - * KryoPool which can serialize ON.lab misc classes. 48 + * KryoNamespace which can serialize ON.lab misc classes.
49 */ 49 */
50 - public static final KryoPool MISC = KryoPool.newBuilder() 50 + public static final KryoNamespace MISC = KryoNamespace.newBuilder()
51 .register(IpPrefix.class, new IpPrefixSerializer()) 51 .register(IpPrefix.class, new IpPrefixSerializer())
52 .register(IpAddress.class, new IpAddressSerializer()) 52 .register(IpAddress.class, new IpAddressSerializer())
53 .register(MacAddress.class, new MacAddressSerializer()) 53 .register(MacAddress.class, new MacAddressSerializer())
...@@ -56,9 +56,9 @@ public final class KryoPoolUtil { ...@@ -56,9 +56,9 @@ public final class KryoPoolUtil {
56 56
57 // TODO: Populate other classes 57 // TODO: Populate other classes
58 /** 58 /**
59 - * KryoPool which can serialize API bundle classes. 59 + * KryoNamespace which can serialize API bundle classes.
60 */ 60 */
61 - public static final KryoPool API = KryoPool.newBuilder() 61 + public static final KryoNamespace API = KryoNamespace.newBuilder()
62 .register(MISC) 62 .register(MISC)
63 .register(ImmutableMap.class, new ImmutableMapSerializer()) 63 .register(ImmutableMap.class, new ImmutableMapSerializer())
64 .register(ImmutableList.class, new ImmutableListSerializer()) 64 .register(ImmutableList.class, new ImmutableListSerializer())
...@@ -104,5 +104,5 @@ public final class KryoPoolUtil { ...@@ -104,5 +104,5 @@ public final class KryoPoolUtil {
104 104
105 105
106 // not to be instantiated 106 // not to be instantiated
107 - private KryoPoolUtil() {} 107 + private KryoNamespaces() {}
108 } 108 }
......
1 package org.onlab.onos.store.serializers; 1 package org.onlab.onos.store.serializers;
2 2
3 -import org.onlab.util.KryoPool; 3 +import org.onlab.util.KryoNamespace;
4 import java.nio.ByteBuffer; 4 import java.nio.ByteBuffer;
5 5
6 /** 6 /**
...@@ -8,7 +8,7 @@ import java.nio.ByteBuffer; ...@@ -8,7 +8,7 @@ import java.nio.ByteBuffer;
8 */ 8 */
9 public class KryoSerializer implements StoreSerializer { 9 public class KryoSerializer implements StoreSerializer {
10 10
11 - protected KryoPool serializerPool; 11 + protected KryoNamespace serializerPool;
12 12
13 public KryoSerializer() { 13 public KryoSerializer() {
14 setupKryoPool(); 14 setupKryoPool();
...@@ -18,8 +18,8 @@ public class KryoSerializer implements StoreSerializer { ...@@ -18,8 +18,8 @@ public class KryoSerializer implements StoreSerializer {
18 * Sets up the common serialzers pool. 18 * Sets up the common serialzers pool.
19 */ 19 */
20 protected void setupKryoPool() { 20 protected void setupKryoPool() {
21 - serializerPool = KryoPool.newBuilder() 21 + serializerPool = KryoNamespace.newBuilder()
22 - .register(KryoPoolUtil.API) 22 + .register(KryoNamespaces.API)
23 .build() 23 .build()
24 .populate(1); 24 .populate(1);
25 } 25 }
......
...@@ -30,7 +30,7 @@ import org.onlab.packet.ChassisId; ...@@ -30,7 +30,7 @@ import org.onlab.packet.ChassisId;
30 import org.onlab.packet.IpAddress; 30 import org.onlab.packet.IpAddress;
31 import org.onlab.packet.IpPrefix; 31 import org.onlab.packet.IpPrefix;
32 import org.onlab.packet.MacAddress; 32 import org.onlab.packet.MacAddress;
33 -import org.onlab.util.KryoPool; 33 +import org.onlab.util.KryoNamespace;
34 34
35 import com.google.common.collect.ImmutableList; 35 import com.google.common.collect.ImmutableList;
36 import com.google.common.collect.ImmutableMap; 36 import com.google.common.collect.ImmutableMap;
...@@ -76,8 +76,8 @@ public class KryoSerializerTest { ...@@ -76,8 +76,8 @@ public class KryoSerializerTest {
76 76
77 @Override 77 @Override
78 protected void setupKryoPool() { 78 protected void setupKryoPool() {
79 - serializerPool = KryoPool.newBuilder() 79 + serializerPool = KryoNamespace.newBuilder()
80 - .register(KryoPoolUtil.API) 80 + .register(KryoNamespaces.API)
81 .build() 81 .build()
82 .populate(1); 82 .populate(1);
83 } 83 }
......
...@@ -20,7 +20,7 @@ import com.google.common.collect.ImmutableList; ...@@ -20,7 +20,7 @@ import com.google.common.collect.ImmutableList;
20 * Pool of Kryo instances, with classes pre-registered. 20 * Pool of Kryo instances, with classes pre-registered.
21 */ 21 */
22 //@ThreadSafe 22 //@ThreadSafe
23 -public final class KryoPool { 23 +public final class KryoNamespace {
24 24
25 /** 25 /**
26 * Default buffer size used for serialization. 26 * Default buffer size used for serialization.
...@@ -34,7 +34,7 @@ public final class KryoPool { ...@@ -34,7 +34,7 @@ public final class KryoPool {
34 private final boolean registrationRequired; 34 private final boolean registrationRequired;
35 35
36 /** 36 /**
37 - * KryoPool builder. 37 + * KryoNamespace builder.
38 */ 38 */
39 //@NotThreadSafe 39 //@NotThreadSafe
40 public static final class Builder { 40 public static final class Builder {
...@@ -42,12 +42,12 @@ public final class KryoPool { ...@@ -42,12 +42,12 @@ public final class KryoPool {
42 private final List<Pair<Class<?>, Serializer<?>>> types = new ArrayList<>(); 42 private final List<Pair<Class<?>, Serializer<?>>> types = new ArrayList<>();
43 43
44 /** 44 /**
45 - * Builds a {@link KryoPool} instance. 45 + * Builds a {@link KryoNamespace} instance.
46 * 46 *
47 - * @return KryoPool 47 + * @return KryoNamespace
48 */ 48 */
49 - public KryoPool build() { 49 + public KryoNamespace build() {
50 - return new KryoPool(types); 50 + return new KryoNamespace(types);
51 } 51 }
52 52
53 /** 53 /**
...@@ -76,19 +76,19 @@ public final class KryoPool { ...@@ -76,19 +76,19 @@ public final class KryoPool {
76 } 76 }
77 77
78 /** 78 /**
79 - * Registers all the class registered to given KryoPool. 79 + * Registers all the class registered to given KryoNamespace.
80 * 80 *
81 - * @param pool KryoPool 81 + * @param pool KryoNamespace
82 * @return this 82 * @return this
83 */ 83 */
84 - public Builder register(final KryoPool pool) { 84 + public Builder register(final KryoNamespace pool) {
85 types.addAll(pool.registeredTypes); 85 types.addAll(pool.registeredTypes);
86 return this; 86 return this;
87 } 87 }
88 } 88 }
89 89
90 /** 90 /**
91 - * Creates a new {@link KryoPool} builder. 91 + * Creates a new {@link KryoNamespace} builder.
92 * 92 *
93 * @return builder 93 * @return builder
94 */ 94 */
...@@ -101,7 +101,7 @@ public final class KryoPool { ...@@ -101,7 +101,7 @@ public final class KryoPool {
101 * 101 *
102 * @param registerdTypes types to register 102 * @param registerdTypes types to register
103 */ 103 */
104 - private KryoPool(final List<Pair<Class<?>, Serializer<?>>> registerdTypes) { 104 + private KryoNamespace(final List<Pair<Class<?>, Serializer<?>>> registerdTypes) {
105 this.registeredTypes = ImmutableList.copyOf(registerdTypes); 105 this.registeredTypes = ImmutableList.copyOf(registerdTypes);
106 // always true for now 106 // always true for now
107 this.registrationRequired = true; 107 this.registrationRequired = true;
...@@ -113,7 +113,7 @@ public final class KryoPool { ...@@ -113,7 +113,7 @@ public final class KryoPool {
113 * @param instances to add to the pool 113 * @param instances to add to the pool
114 * @return this 114 * @return this
115 */ 115 */
116 - public KryoPool populate(int instances) { 116 + public KryoNamespace populate(int instances) {
117 List<Kryo> kryos = new ArrayList<>(instances); 117 List<Kryo> kryos = new ArrayList<>(instances);
118 for (int i = 0; i < instances; ++i) { 118 for (int i = 0; i < instances; ++i) {
119 kryos.add(newKryoInstance()); 119 kryos.add(newKryoInstance());
......
1 package org.onlab.netty; 1 package org.onlab.netty;
2 2
3 -import org.onlab.util.KryoPool; 3 +import org.onlab.util.KryoNamespace;
4 4
5 import java.nio.ByteBuffer; 5 import java.nio.ByteBuffer;
6 import java.util.ArrayList; 6 import java.util.ArrayList;
...@@ -12,7 +12,7 @@ import java.util.HashMap; ...@@ -12,7 +12,7 @@ import java.util.HashMap;
12 */ 12 */
13 public class KryoSerializer { 13 public class KryoSerializer {
14 14
15 - private KryoPool serializerPool; 15 + private KryoNamespace serializerPool;
16 16
17 public KryoSerializer() { 17 public KryoSerializer() {
18 setupKryoPool(); 18 setupKryoPool();
...@@ -23,7 +23,7 @@ public class KryoSerializer { ...@@ -23,7 +23,7 @@ public class KryoSerializer {
23 */ 23 */
24 protected void setupKryoPool() { 24 protected void setupKryoPool() {
25 // FIXME Slice out types used in common to separate pool/namespace. 25 // FIXME Slice out types used in common to separate pool/namespace.
26 - serializerPool = KryoPool.newBuilder() 26 + serializerPool = KryoNamespace.newBuilder()
27 .register(ArrayList.class, 27 .register(ArrayList.class,
28 HashMap.class, 28 HashMap.class,
29 ArrayList.class, 29 ArrayList.class,
......