Skip to content

Commit 8169795

Browse files
Refactor code
1 parent 169e1dc commit 8169795

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.microsoft.azure.functions.worker;
2+
3+
public class Helper {
4+
5+
public static boolean isLoadAppLibsFirst() {
6+
String javaReverseLibLoading = System.getenv(Constants.FUNCTIONS_WORKER_JAVA_LOAD_APP_LIBS);
7+
return Util.isTrue(javaReverseLibLoading);
8+
}
9+
}

src/main/java/com/microsoft/azure/functions/worker/Util.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public class Util {
44
public static boolean isTrue(String value) {
5-
if(value != null && value.toLowerCase().equals("true")) {
5+
if(value != null && (value.toLowerCase().equals("true") || value.toLowerCase().equals("1"))) {
66
return true;
77
}
88
return false;

src/main/java/com/microsoft/azure/functions/worker/broker/JavaFunctionBroker.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import com.microsoft.azure.functions.rpc.messages.*;
1212
import com.microsoft.azure.functions.worker.Constants;
13+
import com.microsoft.azure.functions.worker.Helper;
1314
import com.microsoft.azure.functions.worker.Util;
1415
import com.microsoft.azure.functions.worker.binding.BindingDataStore;
1516
import com.microsoft.azure.functions.worker.description.FunctionMethodDescriptor;
@@ -95,11 +96,10 @@ void registerWithClassLoaderProvider(File libDirectory) {
9596
try {
9697
if(SystemUtils.IS_JAVA_1_8) {
9798
String workerLibPath = System.getenv(Constants.FUNCTIONS_WORKER_DIRECTORY) + "/lib";
98-
String javaReverseLibLoading = System.getenv(Constants.FUNCTIONS_WORKER_JAVA_LOAD_APP_LIBS);
9999
File workerLib = new File(workerLibPath);
100-
101100
verifyLibrariesExist (workerLib, workerLibPath);
102-
if(Util.isTrue(javaReverseLibLoading)) {
101+
102+
if(Helper.isLoadAppLibsFirst()) {
103103
// load client app jars first.
104104
classLoaderProvider.addDirectory(libDirectory);
105105
classLoaderProvider.addDirectory(workerLib);

0 commit comments

Comments
 (0)