This commit is contained in:
@@ -23,7 +23,7 @@ import org.redkale.util.*;
|
||||
* @author zhangjx
|
||||
*/
|
||||
@AutoLoad(false)
|
||||
public class CacheSourceService implements CacheSource, Service {
|
||||
public class CacheSourceService implements CacheSource, Service, AutoCloseable {
|
||||
|
||||
@Resource(name = "APP_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);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.redkale.util.*;
|
||||
* @author zhangjx
|
||||
*/
|
||||
@AutoLoad(false)
|
||||
public class DataSourceService implements DataSource, Service {
|
||||
public class DataSourceService implements DataSource, Service, AutoCloseable {
|
||||
|
||||
@Resource(name = "$")
|
||||
private DataSource source;
|
||||
@@ -319,4 +319,8 @@ public class DataSourceService implements DataSource, Service {
|
||||
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
|
||||
*/
|
||||
@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";
|
||||
|
||||
@@ -278,7 +278,8 @@ public final class DataDefaultSource implements DataSource, Function<Class, Enti
|
||||
return new DataJDBCConnection(createWriteSQLConnection());
|
||||
}
|
||||
|
||||
public void close() {
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
readPool.close();
|
||||
writePool.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user