ReflectASM is a very small Java library that provides high performance reflection by using code generation. An access class is generated to set/get fields, call methods, or create a new instance. The access class uses bytecode rather than Java’s reflection, so it is much faster. It can also access primitive fields via bytecode to avoid boxing.
"HSFBizProcessor-DEFAULT-8-thread-1214" Id=48276 BLOCKED on com.xxx.shade.com.esotericsoftware.reflectasm.AccessClassLoader@30da4559 owned by "HSFBizPr ocessor-DEFAULT-8-thread-1072" Id=48134 at com.xxx.shade.com.esotericsoftware.reflectasm.ConstructorAccess.get(ConstructorAccess.java:54) - blocked on com.xxx.shade.com.esotericsoftware.reflectasm.AccessClassLoader@30da4559 at com.xxx.shade.com.esotericsoftware.kryo.Kryo$DefaultInstantiatorStrategy.newInstantiatorOf(Kryo.java:1233) at com.xxx.shade.com.esotericsoftware.kryo.Kryo.newInstantiator(Kryo.java:1078) at com.xxx.shade.com.esotericsoftware.kryo.Kryo.newInstance(Kryo.java:1087) at com.xxx.shade.com.esotericsoftware.kryo.serializers.FieldSerializer.createCopy(FieldSerializer.java:665) at com.xxx.shade.com.esotericsoftware.kryo.serializers.FieldSerializer.copy(FieldSerializer.java:669) at com.xxx.shade.com.esotericsoftware.kryo.Kryo.copy(Kryo.java:891) at com.xxx.comm.LocalCache.kryoClone(LocalCache.java:137) at com.xxx.comm.LocalCache.get(LocalCache.java:235) at com.xxx.impl.DefaultTairManager.get(DefaultTairManager.java:3388) at com.xxx.impl.mc.MultiClusterTairManager.get(MultiClusterTairManager.java:716)
public ObjectInstantiator newInstantiatorOf(final Class type) { if (!Util.IS_ANDROID) { // Use ReflectASM if the class is not a non-static member class. ClassenclosingType= type.getEnclosingClass(); booleanisNonStaticMemberClass= enclosingType != null && type.isMemberClass() && !Modifier.isStatic(type.getModifiers()); if (!isNonStaticMemberClass) { try { finalConstructorAccessaccess= ConstructorAccess.get(type); returnnewObjectInstantiator() { public Object newInstance() { try { return access.newInstance(); } catch (Exception ex) { thrownewKryoException("Error constructing instance of class: " + className(type), ex); } } }; } catch (Exception ignored) { } } } // Reflection. try { Constructor ctor; try { ctor = type.getConstructor((Class[])null); } catch (Exception ex) { ctor = type.getDeclaredConstructor((Class[])null); ctor.setAccessible(true); } finalConstructorconstructor= ctor; returnnewObjectInstantiator() { public Object newInstance() { try { return constructor.newInstance(); } catch (Exception ex) { thrownewKryoException("Error constructing instance of class: " + className(type), ex); } } }; } catch (Exception ignored) { } if (fallbackStrategy == null) { if (type.isMemberClass() && !Modifier.isStatic(type.getModifiers())) thrownewKryoException("Class cannot be created (non-static member class): " + className(type)); else { StringBuildererrorMessageSb=newStringBuilder("Class cannot be created (missing no-arg constructor): " + className(type)); if (type.getSimpleName().equals("")) { errorMessageSb.append("\n\tThis is an anonymous class, which is not serializable by default in Kryo. Possible solutions: ") .append("1. Remove uses of anonymous classes, including double brace initialization, from the containing ") .append("class. This is the safest solution, as anonymous classes don't have predictable names for serialization.") .append("\n\t2. Register a FieldSerializer for the containing class and call ") .append( "FieldSerializer#setIgnoreSyntheticFields(false) on it. This is not safe but may be sufficient temporarily. ") .append("Use at your own risk."); } thrownewKryoException(errorMessageSb.toString()); } } // InstantiatorStrategy. return fallbackStrategy.newInstantiatorOf(type); }