Search in sources :

Example 1 with WeldException

use of org.jboss.weld.exceptions.WeldException in project Payara by payara.

the class JCDIAroundConstructCallback method aroundConstruct.

@Override
public T aroundConstruct(final ConstructionHandle<T> handle, AnnotatedConstructor<T> constructor, Object[] parameters, Map<String, Object> data) {
    this.handle = handle;
    this.parameters = parameters;
    T ejb;
    try {
        container.intercept(LifecycleCallbackDescriptor.CallbackType.AROUND_CONSTRUCT, ejbContext);
        // all the interceptors were invoked, call the constructor now
        if (target.get() == null) {
            ejb = handle.proceed(parameters, new HashMap<>());
            target.set(ejb);
        }
    } catch (RuntimeException e) {
        throw e;
    } catch (Throwable e) {
        throw new WeldException(e);
    }
    return target.get();
}
Also used : WeldException(org.jboss.weld.exceptions.WeldException) HashMap(java.util.HashMap)

Example 2 with WeldException

use of org.jboss.weld.exceptions.WeldException in project Payara by payara.

the class WeldDeployer method createProbeExtension.

private Metadata<Extension> createProbeExtension() {
    ProbeExtension probeExtension;
    Class<ProbeExtension> probeExtensionClass = ProbeExtension.class;
    try {
        if (System.getSecurityManager() != null) {
            probeExtension = AccessController.doPrivileged(NewInstanceAction.of(probeExtensionClass));
        } else {
            probeExtension = probeExtensionClass.newInstance();
        }
    } catch (Exception e) {
        throw new WeldException(e.getCause());
    }
    return new MetadataImpl<Extension>(probeExtension, "N/A");
}
Also used : WeldException(org.jboss.weld.exceptions.WeldException) MetadataImpl(org.jboss.weld.bootstrap.spi.helpers.MetadataImpl) ProbeExtension(org.jboss.weld.probe.ProbeExtension) DeploymentException(org.glassfish.deployment.common.DeploymentException) WeldException(org.jboss.weld.exceptions.WeldException)

Aggregations

WeldException (org.jboss.weld.exceptions.WeldException)2 HashMap (java.util.HashMap)1 DeploymentException (org.glassfish.deployment.common.DeploymentException)1 MetadataImpl (org.jboss.weld.bootstrap.spi.helpers.MetadataImpl)1 ProbeExtension (org.jboss.weld.probe.ProbeExtension)1