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")
|
@SuppressWarnings("unused")
|
||||||
public static ListenerFactoryBeanManagerDelayedImpl fromBeanManagerReference(Object reference) {
|
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 );
|
return new ListenerFactoryBeanManagerDelayedImpl( (BeanManager) reference );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,17 +42,17 @@ public class ListenerFactoryBeanManagerExtendedImpl implements ListenerFactory,
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public static ListenerFactoryBeanManagerExtendedImpl fromBeanManagerReference(Object reference) {
|
public static ListenerFactoryBeanManagerExtendedImpl fromBeanManagerReference(Object reference) {
|
||||||
return new ListenerFactoryBeanManagerExtendedImpl( (BeanManager) reference );
|
if ( !ExtendedBeanManager.class.isInstance( reference ) ) {
|
||||||
}
|
|
||||||
|
|
||||||
public ListenerFactoryBeanManagerExtendedImpl(BeanManager beanManager) {
|
|
||||||
if ( !ExtendedBeanManager.class.isInstance( beanManager ) ) {
|
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Expecting BeanManager reference that implements optional ExtendedBeanManager contract : " +
|
"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 );
|
log.debugf( "ExtendedBeanManager access requested to CDI BeanManager : " + beanManager );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,12 @@ public class ListenerFactoryBeanManagerStandardImpl implements ListenerFactory {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public static ListenerFactoryBeanManagerStandardImpl fromBeanManagerReference(Object reference) {
|
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 );
|
return new ListenerFactoryBeanManagerStandardImpl( (BeanManager) reference );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue