Search in sources :

Example 6 with AlterableContext

use of javax.enterprise.context.spi.AlterableContext in project core by weld.

the class SuicidalInterceptor method destroyInstance.

private void destroyInstance() throws Exception {
    Context context = manager.getContext(bean.getScope());
    if (!(context instanceof AlterableContext)) {
        throw new IllegalStateException("Context does not support removal of instances");
    }
    AlterableContext alterableContext = AlterableContext.class.cast(context);
    alterableContext.destroy(bean);
}
Also used : Context(javax.enterprise.context.spi.Context) InvocationContext(javax.interceptor.InvocationContext) AlterableContext(javax.enterprise.context.spi.AlterableContext) AlterableContext(javax.enterprise.context.spi.AlterableContext)

Aggregations

AlterableContext (javax.enterprise.context.spi.AlterableContext)6 Test (org.junit.Test)3 Context (javax.enterprise.context.spi.Context)2 EJBException (javax.ejb.EJBException)1 NoSuchEJBException (javax.ejb.NoSuchEJBException)1 ApplicationScoped (javax.enterprise.context.ApplicationScoped)1 Dependent (javax.enterprise.context.Dependent)1 CreationalContext (javax.enterprise.context.spi.CreationalContext)1 InvocationContext (javax.interceptor.InvocationContext)1 ProxyMethodHandler (org.jboss.weld.bean.proxy.ProxyMethodHandler)1 ProxyObject (org.jboss.weld.bean.proxy.ProxyObject)1 WeldCreationalContext (org.jboss.weld.contexts.WeldCreationalContext)1