From 4b78f099cab4a3605544bb44012347bfec0507ec Mon Sep 17 00:00:00 2001 From: Paul Speed Date: Sun, 4 Dec 2016 16:28:12 -0500 Subject: [PATCH] Broke out the Serializer's static initializer into a separate initialize() static method. This allows servers to completely reset the Serializer's registry when restarting the server in the same JVM instance. --- .../com/jme3/network/serializing/Serializer.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/jme3-networking/src/main/java/com/jme3/network/serializing/Serializer.java b/jme3-networking/src/main/java/com/jme3/network/serializing/Serializer.java index ab1d05bc9..0e8307eb2 100644 --- a/jme3-networking/src/main/java/com/jme3/network/serializing/Serializer.java +++ b/jme3-networking/src/main/java/com/jme3/network/serializing/Serializer.java @@ -77,6 +77,20 @@ public abstract class Serializer { // Registers the classes we already have serializers for. static { + initialize(); + } + + public static void initialize() { + + // Reset all of the inexes and tracking variables just in case + idRegistrations.clear(); + classRegistrations.clear(); + registrations.clear(); + + nextAvailableId = -2; // historically the first ID was always -2 + + // Obviously need to be unlocked... + locked = false; // Preregister some fixed serializers so that they don't move // if the list below is modified. Automatic ID generation will