This commit is contained in:
@@ -23,7 +23,7 @@ import org.redkale.util.*;
|
|||||||
* @author zhangjx
|
* @author zhangjx
|
||||||
*/
|
*/
|
||||||
@AutoLoad(false)
|
@AutoLoad(false)
|
||||||
public class CacheSourceService implements CacheSource, Service {
|
public class CacheSourceService implements CacheSource, Service, AutoCloseable {
|
||||||
|
|
||||||
@Resource(name = "APP_HOME")
|
@Resource(name = "APP_HOME")
|
||||||
private File home;
|
private File home;
|
||||||
@@ -118,7 +118,8 @@ public class CacheSourceService implements CacheSource, Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() { //给Application 关闭时调用
|
@Override
|
||||||
|
public void close() throws Exception { //给Application 关闭时调用
|
||||||
destroy(null);
|
destroy(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import org.redkale.util.*;
|
|||||||
* @author zhangjx
|
* @author zhangjx
|
||||||
*/
|
*/
|
||||||
@AutoLoad(false)
|
@AutoLoad(false)
|
||||||
public class DataSourceService implements DataSource, Service {
|
public class DataSourceService implements DataSource, Service, AutoCloseable {
|
||||||
|
|
||||||
@Resource(name = "$")
|
@Resource(name = "$")
|
||||||
private DataSource source;
|
private DataSource source;
|
||||||
@@ -319,4 +319,8 @@ public class DataSourceService implements DataSource, Service {
|
|||||||
return source.querySheet(clazz, selects, flipper, node);
|
return source.querySheet(clazz, selects, flipper, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() throws Exception {
|
||||||
|
source.getClass().getMethod("close").invoke(source);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import org.redkale.util.*;
|
|||||||
* @author zhangjx
|
* @author zhangjx
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public final class DataDefaultSource implements DataSource, Function<Class, EntityInfo> {
|
public final class DataDefaultSource implements DataSource, Function<Class, EntityInfo>, AutoCloseable {
|
||||||
|
|
||||||
public static final String DATASOURCE_CONFPATH = "DATASOURCE_CONFPATH";
|
public static final String DATASOURCE_CONFPATH = "DATASOURCE_CONFPATH";
|
||||||
|
|
||||||
@@ -278,7 +278,8 @@ public final class DataDefaultSource implements DataSource, Function<Class, Enti
|
|||||||
return new DataJDBCConnection(createWriteSQLConnection());
|
return new DataJDBCConnection(createWriteSQLConnection());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() {
|
@Override
|
||||||
|
public void close() throws Exception {
|
||||||
readPool.close();
|
readPool.close();
|
||||||
writePool.close();
|
writePool.close();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user