Copy byte[] before deserializing them using Kryo.

- Attempt to workaround Kryo deserialization issue. (ONOS-1343)

Change-Id: Id77f158b7c572d45484cc68f95fa9d55215101d1
diff --git a/src/main/java/net/onrc/onos/core/datagrid/HazelcastEventChannel.java b/src/main/java/net/onrc/onos/core/datagrid/HazelcastEventChannel.java
index 4afd144..41f78d2 100644
--- a/src/main/java/net/onrc/onos/core/datagrid/HazelcastEventChannel.java
+++ b/src/main/java/net/onrc/onos/core/datagrid/HazelcastEventChannel.java
@@ -1,5 +1,6 @@
 package net.onrc.onos.core.datagrid;
 
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -343,7 +344,9 @@
             //
             // Decode the value
             //
-            byte[] valueBytes = event.getValue();
+            byte[] original = event.getValue();
+            // Copying byte[], to see if it resolves ONOS-1343.
+            byte[] valueBytes = Arrays.copyOf(original, original.length);
             Kryo kryo = kryoFactory.newKryo();
             try {
                 V value = deserializeValue(kryo, valueBytes);
@@ -380,7 +383,9 @@
             //
             // Decode the value
             //
-            byte[] valueBytes = event.getValue();
+            byte[] original = event.getValue();
+            // Copying byte[], to see if it resolves ONOS-1343.
+            byte[] valueBytes = Arrays.copyOf(original, original.length);
             Kryo kryo = kryoFactory.newKryo();
             try {
                 V value = deserializeValue(kryo, valueBytes);
@@ -414,7 +419,9 @@
             //
             // Decode the value
             //
-            byte[] valueBytes = event.getValue();
+            byte[] original = event.getValue();
+            // Copying byte[], to see if it resolves ONOS-1343.
+            byte[] valueBytes = Arrays.copyOf(original, original.length);
             Kryo kryo = kryoFactory.newKryo();
             try {
                 V value = deserializeValue(kryo, valueBytes);