comparison geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java @ 541:3cbf11c67fdc

Experimental caching of SQL results via Ehache geo-backend/trunk@462 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 18 Dec 2009 16:13:52 +0000
parents 5a583cff97ea
children f0b6d0e2a0f6
comparison
equal deleted inserted replaced
385:27082b83c267 541:3cbf11c67fdc
8 /** 8 /**
9 * @author Tim Englich <tim.englich@intevation.de> 9 * @author Tim Englich <tim.englich@intevation.de>
10 * 10 *
11 */ 11 */
12 public class QueryExecutorFactory { 12 public class QueryExecutorFactory {
13
14 public static final String QUERY_EXECUTOR_FACTORY = "query.executor.factory";
13 15
14 /** 16 /**
15 * the logger, used to log exceptions and additonaly information 17 * the logger, used to log exceptions and additonaly information
16 */ 18 */
17 private static Logger log = Logger.getLogger(QueryExecutorFactory.class); 19 private static Logger log = Logger.getLogger(QueryExecutorFactory.class);
23 private static QueryExecutorFactory instance = null; 25 private static QueryExecutorFactory instance = null;
24 26
25 /** 27 /**
26 * Basic-Constructor of this Class 28 * Basic-Constructor of this Class
27 */ 29 */
28 private QueryExecutorFactory() { 30 public QueryExecutorFactory() {
29 super(); 31 super();
30 } 32 }
31 33
32 /** 34 /**
33 * This Method provides an singleton Instance of this Class. 35 * This Method provides an singleton Instance of this Class.
34 * @return an singleton Instance of this Class 36 * @return an singleton Instance of this Class
35 */ 37 */
36 public static QueryExecutorFactory getInstance(){ 38 public static synchronized QueryExecutorFactory getInstance(){
37 if (instance == null){ 39 if (instance == null) {
40 String className = System.getProperty(QUERY_EXECUTOR_FACTORY);
41 if (className != null) {
42 try {
43 Class clazz = Class.forName(className);
44 instance = (QueryExecutorFactory)clazz.newInstance();
45 return instance;
46 }
47 catch (ClassNotFoundException cnfe) {
48 log.error(cnfe);
49 }
50 catch (InstantiationException ie) {
51 log.error(ie);
52 }
53 catch(IllegalAccessException iae) {
54 log.error(iae);
55 }
56 catch (ClassCastException cce) {
57 log.error(cce);
58 }
59 }
60
38 instance = new QueryExecutorFactory(); 61 instance = new QueryExecutorFactory();
39 } 62 }
40 return instance; 63 return instance;
41 } 64 }
42 65

http://dive4elements.wald.intevation.org