diff options
author | Mark Spruiell <mes@zeroc.com> | 2012-10-21 07:30:02 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2012-10-21 07:30:02 -0700 |
commit | 94cf11d600b36a4950caebfa4fc1090f3bf3401e (patch) | |
tree | 38fc87a6a41c2bbe33c9aaea1776520672081f2a /java/src/IceInternal/BasicStream.java | |
parent | Fixed processor documentation (diff) | |
download | ice-94cf11d600b36a4950caebfa4fc1090f3bf3401e.tar.bz2 ice-94cf11d600b36a4950caebfa4fc1090f3bf3401e.tar.xz ice-94cf11d600b36a4950caebfa4fc1090f3bf3401e.zip |
ICE-3635 - static factory maps
Diffstat (limited to 'java/src/IceInternal/BasicStream.java')
-rw-r--r-- | java/src/IceInternal/BasicStream.java | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/java/src/IceInternal/BasicStream.java b/java/src/IceInternal/BasicStream.java index 7ca5ab9e4ac..5d0006dcb07 100644 --- a/java/src/IceInternal/BasicStream.java +++ b/java/src/IceInternal/BasicStream.java @@ -2645,34 +2645,18 @@ public class BasicStream { UserExceptionFactory factory = null; - synchronized(_factoryMutex) - { - factory = _exceptionFactories.get(id); - } - - if(factory == null) + try { - try - { - Class<?> c = findClass(id); - if(c != null) - { - factory = new DynamicUserExceptionFactory(c); - } - } - catch(LinkageError ex) - { - throw new Ice.MarshalException(ex); - } - - if(factory != null) + Class<?> c = findClass(id); + if(c != null) { - synchronized(_factoryMutex) - { - _exceptionFactories.put(id, factory); - } + factory = new DynamicUserExceptionFactory(c); } } + catch(LinkageError ex) + { + throw new Ice.MarshalException(ex); + } return factory; } @@ -2693,7 +2677,14 @@ public class BasicStream // 3. If that fails, check for an Ice.Default.Package property. If found, // prepend the property value to the classname. // - String className = typeToClass(id); + String className = _instance.getClassForType(id); + boolean addClass = false; + if(className == null) + { + className = typeToClass(id); + addClass = true; + } + c = getConcreteClass(className); if(c == null) { @@ -2718,6 +2709,11 @@ public class BasicStream } } + if(c != null && addClass) + { + _instance.addClassForType(id, c.getName()); + } + return c; } @@ -4263,10 +4259,6 @@ public class BasicStream private static final byte FLAG_HAS_SLICE_SIZE = (byte)(1<<4); private static final byte FLAG_IS_LAST_SLICE = (byte)(1<<5); - private static java.util.HashMap<String, UserExceptionFactory> _exceptionFactories = - new java.util.HashMap<String, UserExceptionFactory>(); - private static java.lang.Object _factoryMutex = new java.lang.Object(); // Protects _exceptionFactories. - private static boolean _checkedBZip2 = false; private static java.lang.reflect.Constructor<?> _bzInputStreamCtor; private static java.lang.reflect.Constructor<?> _bzOutputStreamCtor; |