HHH-8706 - Delay registering of the entity listener class as long as possible
This commit is contained in:
parent
90f4fd9d55
commit
3b4c167482
|
@ -41,6 +41,12 @@ public class ListenerFactoryBeanManagerDelayedImpl implements ListenerFactory {
|
|||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public static ListenerFactoryBeanManagerDelayedImpl fromBeanManagerReference(Object reference) {
|
||||
if ( !BeanManager.class.isInstance( reference ) ) {
|
||||
throw new IllegalArgumentException(
|
||||
"Expecting BeanManager reference that implements CDI BeanManager contract : " +
|
||||
reference
|
||||
);
|
||||
}
|
||||
return new ListenerFactoryBeanManagerDelayedImpl( (BeanManager) reference );
|
||||
}
|
||||
|
||||
|
|
|
@ -42,17 +42,17 @@ public class ListenerFactoryBeanManagerExtendedImpl implements ListenerFactory,
|
|||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public static ListenerFactoryBeanManagerExtendedImpl fromBeanManagerReference(Object reference) {
|
||||
return new ListenerFactoryBeanManagerExtendedImpl( (BeanManager) reference );
|
||||
}
|
||||
|
||||
public ListenerFactoryBeanManagerExtendedImpl(BeanManager beanManager) {
|
||||
if ( !ExtendedBeanManager.class.isInstance( beanManager ) ) {
|
||||
if ( !ExtendedBeanManager.class.isInstance( reference ) ) {
|
||||
throw new IllegalArgumentException(
|
||||
"Expecting BeanManager reference that implements optional ExtendedBeanManager contract : " +
|
||||
beanManager
|
||||
reference
|
||||
);
|
||||
}
|
||||
( (ExtendedBeanManager) beanManager ).registerLifecycleListener( this );
|
||||
return new ListenerFactoryBeanManagerExtendedImpl( (ExtendedBeanManager) reference );
|
||||
}
|
||||
|
||||
public ListenerFactoryBeanManagerExtendedImpl(ExtendedBeanManager beanManager) {
|
||||
beanManager.registerLifecycleListener( this );
|
||||
log.debugf( "ExtendedBeanManager access requested to CDI BeanManager : " + beanManager );
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,12 @@ public class ListenerFactoryBeanManagerStandardImpl implements ListenerFactory {
|
|||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public static ListenerFactoryBeanManagerStandardImpl fromBeanManagerReference(Object reference) {
|
||||
if ( !BeanManager.class.isInstance( reference ) ) {
|
||||
throw new IllegalArgumentException(
|
||||
"Expecting BeanManager reference that implements CDI BeanManager contract : " +
|
||||
reference
|
||||
);
|
||||
}
|
||||
return new ListenerFactoryBeanManagerStandardImpl( (BeanManager) reference );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue