This is an automated email from the git hooks/post-receive script. New change to branch develop in repository topia-2.x. See https://gitlab.nuiton.org/nuiton/topia-2.x.git from 9d24d16b [jgitflow-maven-plugin]Updating develop poms back to pre merge state new 17beaa16 Fix connection provider closing The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 17beaa16e50532e5432f5359e6db4d5af7435c24 Author: Eric Chatellier <eric.chatellier@gmail.com> Date: Wed Sep 13 23:07:54 2017 +0200 Fix connection provider closing Summary of changes: .../org/nuiton/topia/framework/TopiaContextImpl.java | 20 ++++++++++++++------ .../java/org/nuiton/topia/framework/TopiaUtil.java | 7 ++++++- 2 files changed, 20 insertions(+), 7 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository topia-2.x. See https://gitlab.nuiton.org/nuiton/topia-2.x.git commit 17beaa16e50532e5432f5359e6db4d5af7435c24 Author: Eric Chatellier <eric.chatellier@gmail.com> Date: Wed Sep 13 23:07:54 2017 +0200 Fix connection provider closing --- .../org/nuiton/topia/framework/TopiaContextImpl.java | 20 ++++++++++++++------ .../java/org/nuiton/topia/framework/TopiaUtil.java | 7 ++++++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java b/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java index 191fbf18..bd9bfbd0 100644 --- a/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java +++ b/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java @@ -838,13 +838,21 @@ public class TopiaContextImpl implements TopiaContextImplementor { hibernate.close(); getParentContext().removeChildContext(this); } else { - if (hibernateFactory != null) { - // XXX AThimel 03/04/14 This is just a security, I'm not sure it is useful anymore - // close connection provider if possible (http://nuiton.org/issues/2757) - ConnectionProvider service = TopiaUtil.getHibernateService(hibernateFactory, ConnectionProvider.class); - if (service != null && service instanceof Stoppable) { - Stoppable stoppable = (Stoppable) service; + // XXX AThimel 03/04/14 This is just a security, I'm not sure it is useful anymore + // close connection provider if possible (http://nuiton.org/issues/2757) + ServiceRegistry serviceRegistry = getServiceRegistry(); + ConnectionProvider service = serviceRegistry.getService(ConnectionProvider.class); + if (service != null && service instanceof Stoppable) { + Stoppable stoppable = (Stoppable) service; + stoppable.stop(); + } + + if (hibernateFactory != null) { + + ConnectionProvider service2 = TopiaUtil.getHibernateService(hibernateFactory, ConnectionProvider.class); + if (service2 != null && service2 instanceof Stoppable) { + Stoppable stoppable = (Stoppable) service2; stoppable.stop(); } diff --git a/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaUtil.java b/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaUtil.java index 34ebdfdb..c35d3c87 100644 --- a/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaUtil.java +++ b/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaUtil.java @@ -56,6 +56,7 @@ import org.hibernate.service.Service; import org.hibernate.service.ServiceRegistry; import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.spi.SessionFactoryServiceRegistry; +import org.hibernate.service.spi.Stoppable; import org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl; import org.hibernate.tool.schema.extract.spi.DatabaseInformation; import org.hibernate.tool.schema.extract.spi.TableInformation; @@ -74,6 +75,7 @@ import org.nuiton.util.RecursiveProperties; import org.nuiton.util.Resource; import com.google.common.base.Supplier; +import com.google.common.util.concurrent.Runnables; /** * TODO-fdesbois-20100507 : Need javadoc + translations for existing methods. @@ -482,7 +484,10 @@ public class TopiaUtil { @Override public void close() throws IOException { // Do not close the SessionFactory, it is probably used somewhere else - + if (connectionProvider != null && connectionProvider instanceof Stoppable) { + Stoppable connectionProviderStoppable = (Stoppable)connectionProvider; + connectionProviderStoppable.stop(); + } // On the over hand, if standardServiceRegistry is provided, that means the its has been created explicitly // for the current instance, close it if (standardServiceRegistry != null && embeddedRegistry) { -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm