before fix,RAY_FUN_CACHE use only get method ,can only get null
  fix : put after create
This commit is contained in:
bibabolynn 2018-10-03 13:53:54 +08:00 committed by Robert Nishihara
parent 3ce8eb2d4c
commit 9c606ea06c

View file

@ -28,7 +28,7 @@ public class FunctionManager {
* Cache from a RayFunc object to its corresponding FunctionDescriptor. Because
* `LambdaUtils.getSerializedLambda` is expensive.
*/
private static final ThreadLocal<WeakHashMap<Class<RayFunc>, FunctionDescriptor>>
private static final ThreadLocal<WeakHashMap<Class<? extends RayFunc>, FunctionDescriptor>>
RAY_FUNC_CACHE = ThreadLocal.withInitial(WeakHashMap::new);
/**
@ -51,6 +51,7 @@ public class FunctionManager {
final String methodName = serializedLambda.getImplMethodName();
final String typeDescriptor = serializedLambda.getImplMethodSignature();
functionDescriptor = new FunctionDescriptor(className, methodName, typeDescriptor);
RAY_FUNC_CACHE.get().put(func.getClass(),functionDescriptor);
}
return getFunction(driverId, functionDescriptor);
}