| CODENOTIFIER | HelpYou are not signed inSign in |
Project: PEtALS
Revision: 8974
Author: rnaudin
Date: 05 Sep 2008 06:09:20
Changes:[ #311035 ] [Xquare BC] The redeployement of a SU trigger a NullPointerException
Files:| ... | ...@@ -98,6 +98,8 @@ | |
| 98 | 98 | extensions = new ConfigurationExtensions(provides.getAny()); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | System.out.println("Extensions : " + extensions); | |
| 102 | ||
| 101 | 103 | // set datasource |
| 102 | 104 | logger.finest("setup dataSource for " + ref); |
| 103 | 105 | DataSource ds = setupDataSource(ref, extensions, classLoader); |
| ... | ...@@ -222,8 +224,8 @@ | |
| 222 | 224 | public void onSUStarted(String serviceUnitName) throws PEtALSCDKException { |
| 223 | 225 | } |
| 224 | 226 | |
| 225 | /*bridge.close(); | |
| 226 | * (non-Javadoc) | |
| 227 | /* | |
| 228 | * bridge.close(); (non-Javadoc) | |
| 227 | 229 | * |
| 228 | 230 | * @see |
| 229 | 231 | * org.ow2.petals.component.framework.su.ServiceUnitListener#onSUStopped |
| ... | ...@@ -244,34 +246,46 @@ | |
| 244 | 246 | throws PEtALSCDKException { |
| 245 | 247 | List<Provides> providesList = descriptor.getServices().getProvides(); |
| 246 | 248 | for (final Provides provides : providesList) { |
| 249 | ||
| 250 | ConfigurationExtensions extensions = null; | |
| 251 | if (this.xQuareComponent.getComponentConfiguration().getPropertiesFile() != null | |
| 252 | && !StringHelper.isNullOrEmpty(this.xQuareComponent.getComponentConfiguration() | |
| 253 | .getPropertiesFile().getValue())) { | |
| 254 | extensions = new ConfigurationExtensions(provides.getAny(), this.xQuareComponent | |
| 255 | .getComponentConfiguration().getPropertiesFile().getValue()); | |
| 256 | } else { | |
| 257 | extensions = new ConfigurationExtensions(provides.getAny()); | |
| 258 | } | |
| 259 | ||
| 247 | 260 | String ref = XQuareUtils.generateKey(provides); |
| 248 | 261 | logger.finest("remove bridges and mapping for " + ref); |
| 249 | 262 | XQBridge bridge = xQuareComponent.getProviderXQBridgesForMapping().remove(ref); |
| 250 | try { | |
| 251 | xQuareComponent.getXQBridgeMappings().remove(bridge).close(); | |
| 252 | } catch (XMLDBCException e) { | |
| 253 | logger.warning("Failed to close a Xquare mapping : " + e.getMessage()); | |
| 254 | } | |
| 255 | //Close the datasource connections once | |
| 256 | try { | |
| 257 | bridge.close(); | |
| 258 | } catch (XMLDBCException e) { | |
| 259 | logger.warning("Failed to close a Xquare bridge : " + e.getMessage()); | |
| 260 | } | |
| 263 | xQuareComponent.getXQBridgeMappings().remove(bridge); | |
| 261 | 264 | xQuareComponent.getProviderXQBridgesForQuery().remove(ref); |
| 262 | ||
| 265 | // do not close either XBridge or mapping, because the DB | |
| 266 | // connections would be closed by the dataSources | |
| 267 | xQuareComponent.getDataSources().removeDataSource(extensions); | |
| 268 | ||
| 263 | 269 | } |
| 264 | 270 | List<Consumes> consumesList = descriptor.getServices().getConsumes(); |
| 265 | 271 | for (final Consumes consumes : consumesList) { |
| 266 | String ref = XQuareUtils.generateKey(consumes); | |
| 267 | logger.finest("remove bridge for notification for " + ref); | |
| 268 | XQBridge bridge = xQuareComponent.getConsumerXQBridges().remove(ref); | |
| 269 | try { | |
| 270 | bridge.close(); | |
| 271 | } catch (XMLDBCException e) { | |
| 272 | logger.warning("Failed to close a Xquare bridge : " + e.getMessage()); | |
| 272 | ||
| 273 | ConfigurationExtensions extensions = null; | |
| 274 | if (this.xQuareComponent.getComponentConfiguration().getPropertiesFile() != null | |
| 275 | && !StringHelper.isNullOrEmpty(this.xQuareComponent.getComponentConfiguration() | |
| 276 | .getPropertiesFile().getValue())) { | |
| 277 | extensions = new ConfigurationExtensions(consumes.getAny(), this.xQuareComponent | |
| 278 | .getComponentConfiguration().getPropertiesFile().getValue()); | |
| 279 | } else { | |
| 280 | extensions = new ConfigurationExtensions(consumes.getAny()); | |
| 273 | 281 | } |
| 274 | 282 | |
| 283 | String ref = XQuareUtils.generateKey(consumes); | |
| 284 | logger.finest("remove bridge for notification for " + ref); | |
| 285 | xQuareComponent.getConsumerXQBridges().remove(ref); | |
| 286 | // do not close either XBridge, because DB connections would be closed | |
| 287 | // by the dataSources | |
| 288 | xQuareComponent.getDataSources().removeDataSource(extensions); | |
| 275 | 289 | } |
| 276 | 290 | } |
| 277 | 291 | } |
| ... | ...@@ -153,4 +153,16 @@ | |
| 153 | 153 | } |
| 154 | 154 | return dataSource; |
| 155 | 155 | } |
| 156 | ||
| 157 | public void removeDataSource(ConfigurationExtensions extensions) throws PEtALSCDKException { | |
| 158 | if (extensions.get(XQuareConstants.XQUARE_JNDI_DATASOURCE) == null) { | |
| 159 | String dsId = XQuareUtils.generateKey(extensions); | |
| 160 | DataSource dataSource = this.dataSources.remove(dsId); | |
| 161 | try { | |
| 162 | ((JDBCDataSource) dataSource).close(); | |
| 163 | } catch (SQLException e) { | |
| 164 | throw new PEtALSCDKException(e.getMessage()); | |
| 165 | } | |
| 166 | } | |
| 167 | } | |
| 156 | 168 | } |
| ... | ...@@ -9,6 +9,9 @@ | |
| 9 | 9 | <body> |
| 10 | 10 | <release version="2.0-SNAPSHOT" date="2007-11-09" |
| 11 | 11 | description="..."> |
| 12 | <action dev="rnaudin" type="update" incident="311035"> | |
| 13 | The redeployement of a SU trigger a NullPointerException | |
| 14 | </action> | |
| 12 | 15 | <action dev="rnaudin" type="update" incident="311022"> |
| 13 | 16 | Add the possibility to get partial results from queries |
| 14 | 17 | </action> |