Mercurial > dive4elements > gnv-client
comparison geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java @ 542:f0b6d0e2a0f6
Small fixes for Ehcache based SQL results caching.
geo-backend/trunk@463 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sat, 19 Dec 2009 14:45:21 +0000 |
parents | 3cbf11c67fdc |
children | 12f88239fb33 |
comparison
equal
deleted
inserted
replaced
541:3cbf11c67fdc | 542:f0b6d0e2a0f6 |
---|---|
39 if (instance == null) { | 39 if (instance == null) { |
40 String className = System.getProperty(QUERY_EXECUTOR_FACTORY); | 40 String className = System.getProperty(QUERY_EXECUTOR_FACTORY); |
41 if (className != null) { | 41 if (className != null) { |
42 try { | 42 try { |
43 Class clazz = Class.forName(className); | 43 Class clazz = Class.forName(className); |
44 instance = (QueryExecutorFactory)clazz.newInstance(); | 44 final QueryExecutorFactory factory = |
45 return instance; | 45 (QueryExecutorFactory)clazz.newInstance(); |
46 Runtime.getRuntime().addShutdownHook(new Thread() { | |
47 public void run() { | |
48 factory.shutdown(); | |
49 } | |
50 }); | |
51 return instance = factory; | |
46 } | 52 } |
47 catch (ClassNotFoundException cnfe) { | 53 catch (ClassNotFoundException cnfe) { |
48 log.error(cnfe); | 54 log.error(cnfe); |
49 } | 55 } |
50 catch (InstantiationException ie) { | 56 catch (InstantiationException ie) { |
60 | 66 |
61 instance = new QueryExecutorFactory(); | 67 instance = new QueryExecutorFactory(); |
62 } | 68 } |
63 return instance; | 69 return instance; |
64 } | 70 } |
65 | 71 |
72 public void shutdown() { | |
73 } | |
66 | 74 |
67 /** | 75 /** |
68 * Getting the QueryExecutor | 76 * Getting the QueryExecutor |
69 * @return the QueryExecutor | 77 * @return the QueryExecutor |
70 */ | 78 */ |