Add IdentifiedDataSerializable to hazelcast.xml config.
- There was a bug, in #718, where Serialization configuration required for datastore mode
is missing in Hazelcast instance created for Event.
This patch adds the required configuration to hazelcast.xml templates.
- WARNING: User need to regenerate hazelcast.xml after this patch.
Change-Id: I6f07810930457336673f7c511540e8ce1d0af746
diff --git a/conf/hazelcast.default.xml b/conf/hazelcast.default.xml
index c6bb74d..b61fc9f 100644
--- a/conf/hazelcast.default.xml
+++ b/conf/hazelcast.default.xml
@@ -20,6 +20,13 @@
</join>
</network>
+ <serialization>
+ <!-- IdentifiedDataSerializableFactory for HZTable.VersionedValue class -->
+ <data-serializable-factories>
+ <data-serializable-factory factory-id="1">net.onrc.onos.core.datastore.hazelcast.VersionedValueSerializableFactory</data-serializable-factory>
+ </data-serializable-factories>
+ </serialization>
+
<!-- Configuration of maps used as a data store. -->
<map name="datastore://*">
<!-- must use 'sync' backup to imitate other data store -->
diff --git a/conf/template/hazelcast.xml.template b/conf/template/hazelcast.xml.template
index b0e5c49..ce0e53e 100644
--- a/conf/template/hazelcast.xml.template
+++ b/conf/template/hazelcast.xml.template
@@ -23,6 +23,13 @@
</join>
</network>
+ <serialization>
+ <!-- IdentifiedDataSerializableFactory for HZTable.VersionedValue class -->
+ <data-serializable-factories>
+ <data-serializable-factory factory-id="1">net.onrc.onos.core.datastore.hazelcast.VersionedValueSerializableFactory</data-serializable-factory>
+ </data-serializable-factories>
+ </serialization>
+
<!-- Configuration of maps used as a data store. -->
<map name="datastore://*">
<!-- must use 'sync' backup to imitate other data store -->
diff --git a/src/main/java/net/onrc/onos/core/datagrid/HazelcastDatagrid.java b/src/main/java/net/onrc/onos/core/datagrid/HazelcastDatagrid.java
index 8632669..7096bd9 100644
--- a/src/main/java/net/onrc/onos/core/datagrid/HazelcastDatagrid.java
+++ b/src/main/java/net/onrc/onos/core/datagrid/HazelcastDatagrid.java
@@ -13,7 +13,6 @@
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.restserver.IRestApiService;
import net.onrc.onos.core.datagrid.web.DatagridWebRoutable;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZClient.java b/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZClient.java
index bb74422..8c34cac 100644
--- a/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZClient.java
+++ b/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZClient.java
@@ -56,6 +56,11 @@
private static final HZClient THE_INSTANCE = new HZClient();
+ /**
+ * Get DataStoreClient implemented on Hazelcast.
+ *
+ * @return HZClient
+ */
public static HZClient getClient() {
return THE_INSTANCE;
}
@@ -170,9 +175,12 @@
/**
* Register serializer for VersionedValue class used to imitate value version.
*
- * @param config
+ * @param config SerializationConfig to add VersionedValueSerializableFactory.
*/
private static void registerSerializer(final SerializationConfig config) {
+ // TODO remove this function at some point.
+ // This method is no longer required, if equibalent to the following
+ // is defined in hazelcast.xml
config.addDataSerializableFactoryClass(
VersionedValueSerializableFactory.FACTORY_ID,
VersionedValueSerializableFactory.class);
diff --git a/src/main/java/net/onrc/onos/core/datastore/hazelcast/VersionedValueSerializableFactory.java b/src/main/java/net/onrc/onos/core/datastore/hazelcast/VersionedValueSerializableFactory.java
index 75bd568..7177695 100644
--- a/src/main/java/net/onrc/onos/core/datastore/hazelcast/VersionedValueSerializableFactory.java
+++ b/src/main/java/net/onrc/onos/core/datastore/hazelcast/VersionedValueSerializableFactory.java
@@ -3,11 +3,20 @@
import com.hazelcast.nio.serialization.DataSerializableFactory;
import com.hazelcast.nio.serialization.IdentifiedDataSerializable;
+/**
+ * IdentifiedDataSerializableFactory for HZTable.VersionedValue class.
+ */
public class VersionedValueSerializableFactory implements
DataSerializableFactory {
// revisit these magic numbers
+ /**
+ * IdentifiedDataSerializable Factory ID.
+ */
public static final int FACTORY_ID = 1;
+ /**
+ * IdentifiedDataSerializable type ID for HZTable.VersionedValue class.
+ */
public static final int VERSIONED_VALUE_ID = 1;
@Override
@@ -20,5 +29,4 @@
return null;
}
}
-
}