From d159dcef6f2eaa11138ebc644c73f4130b3229b2 Mon Sep 17 00:00:00 2001 From: Emmanuel Bernard Date: Tue, 27 Mar 2012 15:44:16 +0200 Subject: [PATCH] HHH-7200 SessionFactoryObservers should be notified of the close event in reverse order of the create event --- .../org/hibernate/internal/SessionFactoryObserverChain.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryObserverChain.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryObserverChain.java index 90d4e2de40..6e383449fd 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryObserverChain.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryObserverChain.java @@ -59,8 +59,10 @@ public class SessionFactoryObserverChain implements SessionFactoryObserver { return; } - for ( SessionFactoryObserver observer : observers ) { - observer.sessionFactoryClosed( factory ); + //notify in reverse order of create notification + int size = observers.size(); + for (int index = size - 1 ; index >= 0 ; index--) { + observers.get( index ).sessionFactoryClosed( factory ); } } }