Browse Source

jfinal 4.3

James 6 years ago
parent
commit
2e6b38fbc2
1 changed files with 18 additions and 12 deletions
  1. 18 12
      src/main/java/com/jfinal/proxy/ProxyCompiler.java

+ 18 - 12
src/main/java/com/jfinal/proxy/ProxyCompiler.java

@@ -50,25 +50,31 @@ public class ProxyCompiler {
 	protected static final Log log = Log.getLog(ProxyCompiler.class);
 	protected static final Log log = Log.getLog(ProxyCompiler.class);
 	
 	
 	// protected List<String> options = Arrays.asList("-target", "1.8" /*, "-parameters"*/);
 	// protected List<String> options = Arrays.asList("-target", "1.8" /*, "-parameters"*/);
-	protected List<String> options = null;
+	protected volatile List<String> options = null;
 	
 	
 	protected List<String> getOptions() {
 	protected List<String> getOptions() {
 		if (options != null) {
 		if (options != null) {
 			return options;
 			return options;
 		}
 		}
 		
 		
-		List<String> ret = new ArrayList<>();
-		ret.add("-target");
-		ret.add("1.8");
-		
-		String cp = getClassPath();
-		if (cp != null && cp.trim().length() != 0) {
-			ret.add("-classpath");
-			ret.add(cp);
+		synchronized (this) {
+			if (options != null) {
+				return options;
+			}
+			
+			List<String> ret = new ArrayList<>();
+			ret.add("-target");
+			ret.add("1.8");
+			
+			String cp = getClassPath();
+			if (cp != null && cp.trim().length() != 0) {
+				ret.add("-classpath");
+				ret.add(cp);
+			}
+			
+			options = ret;
+			return options;
 		}
 		}
-		
-		options = ret;
-		return options;
 	}
 	}
 	
 	
 	/**
 	/**