This commit is contained in:
wentch
2015-12-18 16:33:05 +08:00
parent 366fc22c70
commit 1a45b97813
3 changed files with 11 additions and 5 deletions

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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();
}