comparison geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.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 9f2eaefe9dd4
children 1c3efbd2fc5a
comparison
equal deleted inserted replaced
385:27082b83c267 541:3cbf11c67fdc
56 if (filter != null && filter.length > 0){ 56 if (filter != null && filter.length > 0){
57 //Insert the Filtervalues into the QueryString 57 //Insert the Filtervalues into the QueryString
58 queryString = super.setFilterValues(queryString, filter); 58 queryString = super.setFilterValues(queryString, filter);
59 } 59 }
60 60
61 log.debug("############ QUERY ##################"); 61 if (log.isDebugEnabled()) {
62 log.debug(queryString); 62 log.debug("############ QUERY ##################");
63 log.debug("#######################################"); 63 log.debug(queryString);
64 log.debug("#######################################");
65 }
66
67 returnValue = cachedResults(queryString);
68
69 if (returnValue != null) {
70 return returnValue;
71 }
72
64 Connection connection = null; 73 Connection connection = null;
65 ConnectionPool connectionPool = ConnectionPoolFactory.getInstance().getConnectionPool(); 74 ConnectionPool connectionPool = ConnectionPoolFactory.getInstance().getConnectionPool();
66 try { 75 try {
67 // Submit the Query 76 // Submit the Query
68 connection = connectionPool.getConnection(this.connectionID); 77 connection = connectionPool.getConnection(this.connectionID);
73 82
74 }else{ 83 }else{
75 log.error("Could not establish Databaseconnection."); 84 log.error("Could not establish Databaseconnection.");
76 throw new QueryException("Could not establish Databaseconnection."); 85 throw new QueryException("Could not establish Databaseconnection.");
77 } 86 }
87
88 cacheResults(queryString, returnValue);
78 89
79 } catch (ConnectionException e) { 90 } catch (ConnectionException e) {
80 log.error(e,e); 91 log.error(e,e);
81 throw new QueryException("Could not establish Databaseconnection.",e); 92 throw new QueryException("Could not establish Databaseconnection.",e);
82 } catch (SQLException e) { 93 } catch (SQLException e) {
99 110
100 } catch (QueryContainerException e) { 111 } catch (QueryContainerException e) {
101 log.error(e,e); 112 log.error(e,e);
102 throw new QueryException("Cannot get the Querystring",e); 113 throw new QueryException("Cannot get the Querystring",e);
103 } 114 }
115
104 return returnValue; 116 return returnValue;
105 } 117 }
106 } 118 }

http://dive4elements.wald.intevation.org