| 
															
																@@ -1,6 +1,5 @@ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 package com.xxl.job.core.glue;
 
															 | 
															
															 | 
															
																 package com.xxl.job.core.glue;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-import com.xxl.job.core.glue.loader.GlueLoader;
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import com.xxl.job.core.handler.IJobHandler;
 
															 | 
															
															 | 
															
																 import com.xxl.job.core.handler.IJobHandler;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import groovy.lang.GroovyClassLoader;
 
															 | 
															
															 | 
															
																 import groovy.lang.GroovyClassLoader;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import org.slf4j.Logger;
 
															 | 
															
															 | 
															
																 import org.slf4j.Logger;
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -27,17 +26,6 @@ public class GlueFactory implements ApplicationContextAware { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	 * groovy class loader
 
															 | 
															
															 | 
															
																 	 * groovy class loader
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	 */
 
															 | 
															
															 | 
															
																 	 */
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	private GroovyClassLoader groovyClassLoader = new GroovyClassLoader();
 
															 | 
															
															 | 
															
																 	private GroovyClassLoader groovyClassLoader = new GroovyClassLoader();
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	/**
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	 * code source loader
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	 */
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	private GlueLoader glueLoader;
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	public void setGlueLoader(GlueLoader glueLoader) {
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		this.glueLoader = glueLoader;
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	}
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	public static boolean isActive() {
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		return GlueFactory.glueFactory.glueLoader!=null;
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	}
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	// ----------------------------- spring support -----------------------------
 
															 | 
															
															 | 
															
																 	// ----------------------------- spring support -----------------------------
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	private static ApplicationContext applicationContext;
 
															 | 
															
															 | 
															
																 	private static ApplicationContext applicationContext;
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -56,7 +44,7 @@ public class GlueFactory implements ApplicationContextAware { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	 * inject action of spring
 
															 | 
															
															 | 
															
																 	 * inject action of spring
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	 * @param instance
 
															 | 
															
															 | 
															
																 	 * @param instance
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	 */
 
															 | 
															
															 | 
															
																 	 */
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	public void injectService(Object instance){
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	private void injectService(Object instance){
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		if (instance==null) {
 
															 | 
															
															 | 
															
																 		if (instance==null) {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			return;
 
															 | 
															
															 | 
															
																 			return;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		}
 
															 | 
															
															 | 
															
																 		}
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -106,11 +94,7 @@ public class GlueFactory implements ApplicationContextAware { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	
 
															 | 
															
															 | 
															
																 	
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	// ----------------------------- load instance -----------------------------
 
															 | 
															
															 | 
															
																 	// ----------------------------- load instance -----------------------------
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	// load new instance, prototype
 
															 | 
															
															 | 
															
																 	// load new instance, prototype
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	public IJobHandler loadNewInstance(int jobId) throws Exception{
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		if (jobId==0) {
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			return null;
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		}
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		String codeSource = glueLoader.load(jobId);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	public IJobHandler loadNewInstance(String codeSource) throws Exception{
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		if (codeSource!=null && codeSource.trim().length()>0) {
 
															 | 
															
															 | 
															
																 		if (codeSource!=null && codeSource.trim().length()>0) {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			Class<?> clazz = groovyClassLoader.parseClass(codeSource);
 
															 | 
															
															 | 
															
																 			Class<?> clazz = groovyClassLoader.parseClass(codeSource);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			if (clazz != null) {
 
															 | 
															
															 | 
															
																 			if (clazz != null) {
 
															 |