comparison artifact-database/src/main/java/org/dive4elements/artifactdatabase/Backend.java @ 541:3b1e48d22ce0

Experimentally let database cleaner and backend share the same sql executor.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 03 Sep 2015 15:34:07 +0200
parents 6f6a5b229a7a
children 68f01f10624e
comparison
equal deleted inserted replaced
540:91b1435fb9ea 541:3b1e48d22ce0
269 public Backend(DBConfig config) { 269 public Backend(DBConfig config) {
270 this(); 270 this();
271 this.config = config; 271 this.config = config;
272 sqlExecutor = new SQLExecutor(config.getDBConnection()); 272 sqlExecutor = new SQLExecutor(config.getDBConnection());
273 setupSQL(config.getSQL()); 273 setupSQL(config.getSQL());
274 }
275
276 public SQLExecutor getSQLExecutor() {
277 return sqlExecutor;
274 } 278 }
275 279
276 /** 280 /**
277 * Constructor to create a backend with a link to the database cleaner. 281 * Constructor to create a backend with a link to the database cleaner.
278 * @param cleaner The clean which periodically removes outdated 282 * @param cleaner The clean which periodically removes outdated
704 final Long ttl 708 final Long ttl
705 ) { 709 ) {
706 final int [] id = new int[1]; 710 final int [] id = new int[1];
707 711
708 SQLExecutor.Instance exec = sqlExecutor.new Instance() { 712 SQLExecutor.Instance exec = sqlExecutor.new Instance() {
713 @Override
709 public boolean doIt() throws SQLException { 714 public boolean doIt() throws SQLException {
710 prepareStatement(SQL_NEXT_ID); 715 prepareStatement(SQL_NEXT_ID);
711 result = stmnt.executeQuery(); 716 result = stmnt.executeQuery();
712 717
713 if (!result.next()) { 718 if (!result.next()) {

http://dive4elements.wald.intevation.org