Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix NPE issue #684

Merged
merged 3 commits into from
Dec 7, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ public class JavaFunctionBroker {
private final Map<String, ImmutablePair<String, FunctionDefinition>> methods;
private final ClassLoaderProvider classLoaderProvider;
private String workerDirectory;
private final AtomicBoolean oneTimeLogicInitialized = new AtomicBoolean(false);
private boolean oneTimeLogicInitialized = false;
private volatile InvocationChainFactory invocationChainFactory;
private volatile FunctionInstanceInjector functionInstanceInjector;
private final Object lock = new Object();
kaibocai marked this conversation as resolved.
Show resolved Hide resolved

private FunctionInstanceInjector newInstanceInjector() {
return new FunctionInstanceInjector() {
Expand All @@ -63,9 +64,12 @@ public void loadMethod(FunctionMethodDescriptor descriptor, Map<String, BindingI
}

private void initializeOneTimeLogics() {
kaibocai marked this conversation as resolved.
Show resolved Hide resolved
if (!oneTimeLogicInitialized.getAndSet(true)) {
initializeInvocationChainFactory();
initializeFunctionInstanceInjector();
synchronized (lock) {
if (!oneTimeLogicInitialized) {
initializeInvocationChainFactory();
initializeFunctionInstanceInjector();
oneTimeLogicInitialized = true;
}
}
}

Expand Down