Committed by
Yuta HIGUCHI
Serializer related fixes
- DefaultGroupId is part of API - KryoNamespace is thread-safe, use same instance. Change-Id: I492f48c2ae9239edb5742c00231cd24b4d6db6a3
Showing
1 changed file
with
6 additions
and
7 deletions
| ... | @@ -144,8 +144,6 @@ public class DistributedGroupStore | ... | @@ -144,8 +144,6 @@ public class DistributedGroupStore |
| 144 | 144 | ||
| 145 | private final AtomicInteger groupIdGen = new AtomicInteger(); | 145 | private final AtomicInteger groupIdGen = new AtomicInteger(); |
| 146 | 146 | ||
| 147 | - private KryoNamespace.Builder kryoBuilder = null; | ||
| 148 | - | ||
| 149 | private KryoNamespace clusterMsgSerializer; | 147 | private KryoNamespace clusterMsgSerializer; |
| 150 | 148 | ||
| 151 | @Property(name = "garbageCollect", boolValue = GARBAGE_COLLECT, | 149 | @Property(name = "garbageCollect", boolValue = GARBAGE_COLLECT, |
| ... | @@ -160,8 +158,9 @@ public class DistributedGroupStore | ... | @@ -160,8 +158,9 @@ public class DistributedGroupStore |
| 160 | @Activate | 158 | @Activate |
| 161 | public void activate() { | 159 | public void activate() { |
| 162 | cfgService.registerProperties(getClass()); | 160 | cfgService.registerProperties(getClass()); |
| 163 | - kryoBuilder = new KryoNamespace.Builder() | 161 | + KryoNamespace.Builder kryoBuilder = new KryoNamespace.Builder() |
| 164 | .register(KryoNamespaces.API) | 162 | .register(KryoNamespaces.API) |
| 163 | + .nextId(KryoNamespaces.BEGIN_USER_CUSTOM_ID) | ||
| 165 | .register(DefaultGroup.class, | 164 | .register(DefaultGroup.class, |
| 166 | DefaultGroupBucket.class, | 165 | DefaultGroupBucket.class, |
| 167 | DefaultGroupDescription.class, | 166 | DefaultGroupDescription.class, |
| ... | @@ -169,7 +168,6 @@ public class DistributedGroupStore | ... | @@ -169,7 +168,6 @@ public class DistributedGroupStore |
| 169 | GroupDescription.Type.class, | 168 | GroupDescription.Type.class, |
| 170 | Group.GroupState.class, | 169 | Group.GroupState.class, |
| 171 | GroupBuckets.class, | 170 | GroupBuckets.class, |
| 172 | - DefaultGroupId.class, | ||
| 173 | GroupStoreMessage.class, | 171 | GroupStoreMessage.class, |
| 174 | GroupStoreMessage.Type.class, | 172 | GroupStoreMessage.Type.class, |
| 175 | UpdateType.class, | 173 | UpdateType.class, |
| ... | @@ -180,7 +178,8 @@ public class DistributedGroupStore | ... | @@ -180,7 +178,8 @@ public class DistributedGroupStore |
| 180 | GroupStoreMapKey.class | 178 | GroupStoreMapKey.class |
| 181 | ); | 179 | ); |
| 182 | 180 | ||
| 183 | - clusterMsgSerializer = kryoBuilder.build(); | 181 | + clusterMsgSerializer = kryoBuilder.build("GroupStore"); |
| 182 | + Serializer serializer = Serializer.using(clusterMsgSerializer); | ||
| 184 | 183 | ||
| 185 | messageHandlingExecutor = Executors. | 184 | messageHandlingExecutor = Executors. |
| 186 | newFixedThreadPool(MESSAGE_HANDLER_THREAD_POOL_SIZE, | 185 | newFixedThreadPool(MESSAGE_HANDLER_THREAD_POOL_SIZE, |
| ... | @@ -197,7 +196,7 @@ public class DistributedGroupStore | ... | @@ -197,7 +196,7 @@ public class DistributedGroupStore |
| 197 | 196 | ||
| 198 | groupStoreEntriesByKey = storageService.<GroupStoreKeyMapKey, StoredGroupEntry>consistentMapBuilder() | 197 | groupStoreEntriesByKey = storageService.<GroupStoreKeyMapKey, StoredGroupEntry>consistentMapBuilder() |
| 199 | .withName("onos-group-store-keymap") | 198 | .withName("onos-group-store-keymap") |
| 200 | - .withSerializer(Serializer.using(kryoBuilder.build())) | 199 | + .withSerializer(serializer) |
| 201 | .build(); | 200 | .build(); |
| 202 | groupStoreEntriesByKey.addListener(new GroupStoreKeyMapListener()); | 201 | groupStoreEntriesByKey.addListener(new GroupStoreKeyMapListener()); |
| 203 | log.debug("Current size of groupstorekeymap:{}", | 202 | log.debug("Current size of groupstorekeymap:{}", |
| ... | @@ -207,7 +206,7 @@ public class DistributedGroupStore | ... | @@ -207,7 +206,7 @@ public class DistributedGroupStore |
| 207 | 206 | ||
| 208 | auditPendingReqQueue = storageService.<GroupStoreKeyMapKey, StoredGroupEntry>consistentMapBuilder() | 207 | auditPendingReqQueue = storageService.<GroupStoreKeyMapKey, StoredGroupEntry>consistentMapBuilder() |
| 209 | .withName("onos-pending-group-keymap") | 208 | .withName("onos-pending-group-keymap") |
| 210 | - .withSerializer(Serializer.using(kryoBuilder.build())) | 209 | + .withSerializer(serializer) |
| 211 | .build(); | 210 | .build(); |
| 212 | log.debug("Current size of pendinggroupkeymap:{}", | 211 | log.debug("Current size of pendinggroupkeymap:{}", |
| 213 | auditPendingReqQueue.size()); | 212 | auditPendingReqQueue.size()); | ... | ... |
-
Please register or login to post a comment