This commit is contained in:
wentch
2015-12-28 16:22:08 +08:00
parent 751da87d48
commit af0b3e198b
2 changed files with 9 additions and 4 deletions

View File

@@ -24,7 +24,7 @@ public abstract class DataConnection {
public abstract boolean commit(); public abstract boolean commit();
public abstract void rollback(); public abstract boolean rollback();
public abstract void close(); public abstract boolean close();
} }

View File

@@ -84,11 +84,14 @@ public final class DataDefaultSource implements DataSource, Function<Class, Enti
} }
@Override @Override
public void close() { public boolean close() {
try { try {
if(sqlconn == null || sqlconn.isClosed()) return true;
sqlconn.close(); sqlconn.close();
return true;
} catch (Exception e) { } catch (Exception e) {
//do nothing //do nothing
return false;
} }
} }
@@ -103,11 +106,13 @@ public final class DataDefaultSource implements DataSource, Function<Class, Enti
} }
@Override @Override
public void rollback() { public boolean rollback() {
try { try {
sqlconn.rollback(); sqlconn.rollback();
return true;
} catch (Exception e) { } catch (Exception e) {
//do nothing //do nothing
return false;
} }
} }
} }