Просмотр исходного кода

Added some more information to the logging.
Removed an errant nextId decrement that would occur
even if the class was already registered and already
had an ID. This makes the teetering tower of glass
shards slightly less fragile... slightly.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7722 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

PSp..om 14 лет назад
Родитель
Сommit
68bac95cd5

+ 9 - 3
engine/src/networking/com/jme3/network/serializing/Serializer.java

@@ -172,7 +172,7 @@ public abstract class Serializer {
 
             serializer.initialize(cls);
 
-            log.log( Level.INFO, "Registered class:{0}.", cls );
+            log.log( Level.INFO, "Registered class[" + classId + "]:{0}.", cls );
             return reg;
         }
         if (failOnMiss) {
@@ -233,12 +233,18 @@ public abstract class Serializer {
     public static SerializerRegistration registerClass(Class cls, Serializer serializer) {
         SerializerRegistration existingReg = getExactSerializerRegistration(cls);
 
-        short id = --nextId;
-        if (existingReg != null) id = existingReg.getId();
+        short id;
+        if (existingReg != null) { 
+            id = existingReg.getId();
+        } else {
+            id = --nextId;
+        }            
         SerializerRegistration reg = new SerializerRegistration(serializer, cls, id);
 
         idRegistrations.put(id, reg);
         classRegistrations.put(cls, reg);
+        
+        log.log( Level.INFO, "Registered class[" + id + "]:{0} to:" + serializer, cls );
 
         serializer.initialize(cls);