Mercurial > dive4elements > gnv-client
comparison geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java @ 265:e5379e129799
Fixed issue 34
geo-backend/trunk@215 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 13 Oct 2009 13:20:26 +0000 |
parents | e4eacd613356 |
children | ff1b7967e6b9 |
comparison
equal
deleted
inserted
replaced
264:5bbdbc0bbddc | 265:e5379e129799 |
---|---|
2 * | 2 * |
3 */ | 3 */ |
4 package de.intevation.gnv.geobackend.sde.connectionpool; | 4 package de.intevation.gnv.geobackend.sde.connectionpool; |
5 | 5 |
6 import java.sql.Connection; | 6 import java.sql.Connection; |
7 import java.sql.SQLException; | |
7 import java.util.Properties; | 8 import java.util.Properties; |
8 | 9 |
9 import org.apache.commons.pool.PoolableObjectFactory; | 10 import org.apache.commons.pool.PoolableObjectFactory; |
10 import org.apache.log4j.Logger; | 11 import org.apache.log4j.Logger; |
11 | |
12 import com.esri.sde.sdk.client.SeConnection; | |
13 | 12 |
14 import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException; | 13 import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException; |
15 import de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnection; | 14 import de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnection; |
16 | 15 |
17 /** | 16 /** |
77 /** | 76 /** |
78 * @see org.apache.commons.pool.PoolableObjectFactory#destroyObject(java.lang.Object) | 77 * @see org.apache.commons.pool.PoolableObjectFactory#destroyObject(java.lang.Object) |
79 */ | 78 */ |
80 public void destroyObject(Object arg0) throws Exception { | 79 public void destroyObject(Object arg0) throws Exception { |
81 log.debug("ArcSDEPoolableObjectFactory.destroyObjectb"); | 80 log.debug("ArcSDEPoolableObjectFactory.destroyObjectb"); |
82 if (arg0 instanceof SeConnection){ | 81 if (arg0 instanceof ArcSDEConnection) { |
83 ((SeConnection)arg0).close(); | 82 ((ArcSDEConnection)arg0).close(); |
84 }else{ | 83 }else{ |
85 log.warn("Object cannot be handled"); | 84 log.warn("Object cannot be handled"); |
86 } | 85 } |
87 } | 86 } |
88 | 87 |
113 * @see org.apache.commons.pool.PoolableObjectFactory#validateObject(java.lang.Object) | 112 * @see org.apache.commons.pool.PoolableObjectFactory#validateObject(java.lang.Object) |
114 */ | 113 */ |
115 public boolean validateObject(Object arg0) { | 114 public boolean validateObject(Object arg0) { |
116 // TODO Was muss hier passieren? | 115 // TODO Was muss hier passieren? |
117 log.debug("ArcSDEPoolableObjectFactory.validateObject"); | 116 log.debug("ArcSDEPoolableObjectFactory.validateObject"); |
118 return true; | 117 boolean returnValue = false; |
118 try { | |
119 returnValue = arg0 instanceof ArcSDEConnection | |
120 ? !((ArcSDEConnection)arg0).isClosed() | |
121 : false; | |
122 } | |
123 catch (SQLException sqle) {} | |
124 return returnValue; | |
119 } | 125 } |
120 } | 126 } |