parent
1b3ad6fbbe
commit
d2eafe20cd
@ -1,16 +1,16 @@
|
|||||||
package com.xxl.job.core.glue.loader;
|
//package com.xxl.job.core.glue.loader;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* code source loader
|
// * code source loader
|
||||||
* @author xuxueli 2016-1-2 20:01:39
|
// * @author xuxueli 2016-1-2 20:01:39
|
||||||
*/
|
// */
|
||||||
public interface GlueLoader {
|
//public interface GlueLoader {
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* load code source by name, ensure every load is the latest.
|
// * load code source by name, ensure every load is the latest.
|
||||||
* @param jobId
|
// * @param jobId
|
||||||
* @return code source
|
// * @return code source
|
||||||
*/
|
// */
|
||||||
public String load(int jobId);
|
// public String load(int jobId);
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
package com.xxl.job.core.glue.loader.impl;
|
//package com.xxl.job.core.glue.loader.impl;
|
||||||
|
//
|
||||||
import com.xxl.job.core.glue.loader.GlueLoader;
|
//import com.xxl.job.core.glue.loader.GlueLoader;
|
||||||
import com.xxl.job.core.util.DBUtil;
|
//import com.xxl.job.core.util.DBUtil;
|
||||||
|
//
|
||||||
import javax.sql.DataSource;
|
//import javax.sql.DataSource;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
import java.util.Map;
|
//import java.util.Map;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by xuxueli on 16/9/30.
|
// * Created by xuxueli on 16/9/30.
|
||||||
*/
|
// */
|
||||||
public class DbGlueLoader implements GlueLoader {
|
//public class DbGlueLoader implements GlueLoader {
|
||||||
|
//
|
||||||
private DataSource dataSource;
|
// private DataSource dataSource;
|
||||||
public void setDataSource(DataSource dataSource) {
|
// public void setDataSource(DataSource dataSource) {
|
||||||
this.dataSource = dataSource;
|
// this.dataSource = dataSource;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public String load(int jobId) {
|
// public String load(int jobId) {
|
||||||
String sql = "SELECT glue_source FROM XXL_JOB_QRTZ_TRIGGER_INFO WHERE id = ?";
|
// String sql = "SELECT glue_source FROM XXL_JOB_QRTZ_TRIGGER_INFO WHERE id = ?";
|
||||||
List<Map<String, Object>> result = DBUtil.query(dataSource, sql, new Object[]{jobId});
|
// List<Map<String, Object>> result = DBUtil.query(dataSource, sql, new Object[]{jobId});
|
||||||
if (result!=null && result.size()==1 && result.get(0)!=null && result.get(0).get("glue_source")!=null ) {
|
// if (result!=null && result.size()==1 && result.get(0)!=null && result.get(0).get("glue_source")!=null ) {
|
||||||
return (String) result.get(0).get("glue_source");
|
// return (String) result.get(0).get("glue_source");
|
||||||
}
|
// }
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
Loading…
Reference in new issue