HHH-12133 Ignore managed bean release errors related to already released beans
This commit is contained in:
parent
bc304235a6
commit
be6ac17d1e
|
@ -6,11 +6,14 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.resource.beans.internal;
|
package org.hibernate.resource.beans.internal;
|
||||||
|
|
||||||
|
import javax.enterprise.context.ContextNotActiveException;
|
||||||
import javax.enterprise.inject.Instance;
|
import javax.enterprise.inject.Instance;
|
||||||
import javax.enterprise.inject.spi.BeanManager;
|
import javax.enterprise.inject.spi.BeanManager;
|
||||||
|
|
||||||
import org.hibernate.resource.beans.spi.ManagedBean;
|
import org.hibernate.resource.beans.spi.ManagedBean;
|
||||||
|
|
||||||
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link CdiLifecycleManagementStrategy} to use when CDI compliance is required
|
* A {@link CdiLifecycleManagementStrategy} to use when CDI compliance is required
|
||||||
* (i.e. when the bean lifecycle is to be managed by the CDI runtime, not the JPA runtime).
|
* (i.e. when the bean lifecycle is to be managed by the CDI runtime, not the JPA runtime).
|
||||||
|
@ -22,6 +25,7 @@ import org.hibernate.resource.beans.spi.ManagedBean;
|
||||||
* and are not duplicated, in contrast to {@link JpaCdiLifecycleManagementStrategy}.
|
* and are not duplicated, in contrast to {@link JpaCdiLifecycleManagementStrategy}.
|
||||||
*/
|
*/
|
||||||
class StandardCdiLifecycleManagementStrategy implements CdiLifecycleManagementStrategy {
|
class StandardCdiLifecycleManagementStrategy implements CdiLifecycleManagementStrategy {
|
||||||
|
private static final Logger log = Logger.getLogger( CompositeManagedBeanRegistry.class );
|
||||||
|
|
||||||
static final StandardCdiLifecycleManagementStrategy INSTANCE = new StandardCdiLifecycleManagementStrategy();
|
static final StandardCdiLifecycleManagementStrategy INSTANCE = new StandardCdiLifecycleManagementStrategy();
|
||||||
|
|
||||||
|
@ -70,7 +74,17 @@ class StandardCdiLifecycleManagementStrategy implements CdiLifecycleManagementSt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void release() {
|
public void release() {
|
||||||
|
try {
|
||||||
instance.destroy( beanInstance );
|
instance.destroy( beanInstance );
|
||||||
}
|
}
|
||||||
|
catch (ContextNotActiveException e) {
|
||||||
|
log.debugf(
|
||||||
|
"Error destroying managed bean instance [%s] - the context is not active anymore."
|
||||||
|
+ " The instance must have been destroyed already - ignoring.",
|
||||||
|
instance,
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue