GH-1066 Add class caching for FunctionClassUtils in serverless-web
Resolves #1066
This commit is contained in:
@@ -46,6 +46,8 @@ public final class FunctionClassUtils {
|
|||||||
|
|
||||||
private static Log logger = LogFactory.getLog(FunctionClassUtils.class);
|
private static Log logger = LogFactory.getLog(FunctionClassUtils.class);
|
||||||
|
|
||||||
|
private static Class<?> MAIN_CLASS;
|
||||||
|
|
||||||
private FunctionClassUtils() {
|
private FunctionClassUtils() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -59,8 +61,11 @@ public final class FunctionClassUtils {
|
|||||||
* @return instance of Class which represent the start class of the application.
|
* @return instance of Class which represent the start class of the application.
|
||||||
*/
|
*/
|
||||||
public static Class<?> getStartClass() {
|
public static Class<?> getStartClass() {
|
||||||
ClassLoader classLoader = FunctionClassUtils.class.getClassLoader();
|
if (MAIN_CLASS == null) {
|
||||||
return getStartClass(classLoader);
|
ClassLoader classLoader = FunctionClassUtils.class.getClassLoader();
|
||||||
|
MAIN_CLASS = getStartClass(classLoader);
|
||||||
|
}
|
||||||
|
return MAIN_CLASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Class<?> getStartClass(ClassLoader classLoader) {
|
static Class<?> getStartClass(ClassLoader classLoader) {
|
||||||
|
|||||||
Reference in New Issue
Block a user