@@ -68,13 +68,13 @@ public JavaFunctionBroker(ClassLoaderProvider classLoaderProvider) {
68
68
this .workerObjectCache = null ;
69
69
}
70
70
71
- initializeOneTimeLogics ();
72
71
}
73
72
74
73
public void loadMethod (FunctionMethodDescriptor descriptor , Map <String , BindingInfo > bindings )
75
74
throws ClassNotFoundException , NoSuchMethodException , IOException {
76
75
descriptor .validate ();
77
76
addSearchPathsToClassLoader (descriptor );
77
+ initializeOneTimeLogics ();
78
78
FunctionDefinition functionDefinition = new FunctionDefinition (descriptor , bindings , classLoaderProvider );
79
79
80
80
if (JAVA_ENABLE_SDK_TYPES_FLAG ) {
@@ -112,14 +112,14 @@ private void initializeOneTimeLogics() {
112
112
synchronized (oneTimeLogicInitializationLock ) {
113
113
if (!oneTimeLogicInitialized ) {
114
114
userContextClassLoader = classLoaderProvider .createClassLoader ();
115
+ oneTimeLogicInitialized = true ;
116
+ initializeFunctionInstanceInjector ();
117
+
115
118
if (JAVA_ENABLE_SDK_TYPES_FLAG ) {
116
119
loadGlobalMiddlewares ();
117
120
} else {
118
121
initializeInvocationChainFactory ();
119
122
}
120
-
121
- initializeFunctionInstanceInjector ();
122
- oneTimeLogicInitialized = true ;
123
123
}
124
124
}
125
125
}
@@ -146,15 +146,14 @@ private void initializeInvocationChainFactory() {
146
146
Thread .currentThread ().setContextClassLoader (userContextClassLoader );
147
147
for (Middleware middleware : ServiceLoader .load (Middleware .class )) {
148
148
this .serviceLoadedMiddlewares .add (middleware );
149
- WorkerLogManager .getSystemLogger ().info ("Load middleware " + middleware .getClass ().getSimpleName ());
149
+ WorkerLogManager .getSystemLogger ().info ("Load middleware test!! " + middleware .getClass ().getSimpleName ());
150
150
}
151
151
} finally {
152
152
Thread .currentThread ().setContextClassLoader (prevContextClassLoader );
153
+ ArrayList <Middleware > middlewares = new ArrayList <>(this .serviceLoadedMiddlewares );
154
+ middlewares .add (getFunctionExecutionMiddleWare (userContextClassLoader ));
155
+ this .invocationChainFactory = new InvocationChainFactory (middlewares );
153
156
}
154
-
155
- ArrayList <Middleware > middlewares = new ArrayList <>(this .serviceLoadedMiddlewares );
156
- middlewares .add (getFunctionExecutionMiddleWare (userContextClassLoader ));
157
- this .invocationChainFactory = new InvocationChainFactory (middlewares );
158
157
}
159
158
160
159
private void initializeFunctionInstanceInjector () {
0 commit comments