Search in sources :

Example 1 with AbstractContainerEvent

use of org.jboss.weld.bootstrap.events.AbstractContainerEvent in project core by weld.

the class ProbeExtension method addContainerLifecycleEvent.

private <T> void addContainerLifecycleEvent(T event, Object info, BeanManagerImpl beanManagerImpl) {
    ResolvedObservers<?> resolvedObservers = null;
    Type eventType = null;
    if (event instanceof AbstractContainerEvent) {
        AbstractContainerEvent containerEvent = (AbstractContainerEvent) event;
        eventType = containerEvent.getEventType();
        resolvedObservers = beanManagerImpl.getGlobalLenientObserverNotifier().resolveObserverMethods(eventType);
    } else if (event instanceof ProcessAnnotatedTypeImpl) {
        ProcessAnnotatedTypeImpl<?> processAnnotatedTypeEvent = (ProcessAnnotatedTypeImpl<?>) event;
        eventType = ProcessAnnotatedType.class;
        info = Formats.formatType(processAnnotatedTypeEvent.getOriginalAnnotatedType().getBaseType(), false);
        resolvedObservers = beanManagerImpl.getGlobalLenientObserverNotifier().resolveObserverMethods(ProcessAnnotatedTypeEventResolvable.of(processAnnotatedTypeEvent, beanManagerImpl.getServices().get(RequiredAnnotationDiscovery.class)));
    }
    if (resolvedObservers != null && eventType != null) {
        probe.addEvent(new EventInfo(eventType, Collections.emptySet(), info, null, Reflections.cast(resolvedObservers.getAllObservers()), true, System.currentTimeMillis(), false));
    }
}
Also used : ProcessAnnotatedType(javax.enterprise.inject.spi.ProcessAnnotatedType) EventType(org.jboss.weld.probe.BootstrapStats.EventType) ProcessAnnotatedType(javax.enterprise.inject.spi.ProcessAnnotatedType) Type(java.lang.reflect.Type) AnnotatedType(javax.enterprise.inject.spi.AnnotatedType) VetoedSuppressedAnnotatedType(org.jboss.weld.util.annotated.VetoedSuppressedAnnotatedType) AbstractContainerEvent(org.jboss.weld.bootstrap.events.AbstractContainerEvent) ProcessAnnotatedTypeImpl(org.jboss.weld.bootstrap.events.ProcessAnnotatedTypeImpl)

Aggregations

Type (java.lang.reflect.Type)1 AnnotatedType (javax.enterprise.inject.spi.AnnotatedType)1 ProcessAnnotatedType (javax.enterprise.inject.spi.ProcessAnnotatedType)1 AbstractContainerEvent (org.jboss.weld.bootstrap.events.AbstractContainerEvent)1 ProcessAnnotatedTypeImpl (org.jboss.weld.bootstrap.events.ProcessAnnotatedTypeImpl)1 EventType (org.jboss.weld.probe.BootstrapStats.EventType)1 VetoedSuppressedAnnotatedType (org.jboss.weld.util.annotated.VetoedSuppressedAnnotatedType)1