public void release() { context.release(); } }
@Override public void destroy(T instance, CreationalContext<T> creationalContext) { creationalContext.release(); }
@Override public void release() { context.release(); }
public void destroy(T instance, CreationalContext<T> creationalContext) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(String.format("Destroying bean instance %s for repository type '%s'.", instance.toString(), beanClass.getName())); } creationalContext.release(); }
@Override public void release() { try { injectionTarget.preDestroy(instance); } finally { ctx.release(); } }
@Override public void stop(final StopContext context) { beanManager = null; synchronized (contexts) { for (Holder holder : contexts.values()) { // Only release the context for @Dependent beans, Weld should take care of the other scopes if (holder.isDependent()) { holder.context.release(); } } contexts.clear(); } }
/** * Dispose of the instance, doing any necessary cleanup * * @throws IllegalStateException if dispose() is called before produce() is called * @throws IllegalStateException if dispose() is called on an instance that has already been disposed * @return self */ public UnmanagedInstance<T> dispose() { if (instance == null) { throw new IllegalStateException("Trying to call dispose() before produce() was called"); } if (disposed) { throw new IllegalStateException("Trying to call dispose() on already disposed instance"); } disposed = true; injectionTarget.dispose(instance); ctx.release(); return this; }
@Override public void release() { if ( beanInstance == null ) { return; } try { if ( bean == null ) { // todo : BeanInstanceProducer#release? return; } bean.destroy( beanInstance, creationalContext ); } catch (Exception ignore) { } finally { if ( creationalContext != null ) { try { creationalContext.release(); } catch (Exception ignore) { } } this.beanInstance = null; this.creationalContext = null; this.bean = null; this.beanManager = null; } }
@Override public void destroy(Supplier<T> instance, CreationalContext<Supplier<T>> context) { injectionTarget.preDestroy(instance); injectionTarget.dispose(instance); context.release(); }
@Override public void destroy(T instance, CreationalContext<T> context) { injectionTarget.preDestroy(instance); injectionTarget.dispose(instance); context.release(); }
@Override public void destroy(CdiRequestScope instance, CreationalContext<CdiRequestScope> context) { injectionTarget.preDestroy(instance); injectionTarget.dispose(instance); context.release(); }
@Override public void destroy(ValidationInterceptor instance, CreationalContext<ValidationInterceptor> ctx) { interceptorTarget.preDestroy(instance); interceptorTarget.dispose(instance); ctx.release(); } });
@Override public void destroy(CdiExternalRequestScope instance, CreationalContext<CdiExternalRequestScope> ctx) { interceptorTarget.preDestroy(instance); interceptorTarget.dispose(instance); ctx.release(); } });
@Override public void destroy(final Object instance) { final Holder holder = contexts.remove(instance); if (holder == null) { // This bean was not created via CDI, we need to invoke the JBeret cleanup super.destroy(instance); } else { // Only release the context for @Dependent beans, Weld should take care of the other scopes if (holder.isDependent()) { // We're not destroying the bean here because weld should handle that for use when we release the // CreationalContext holder.context.release(); } } }
@Override public void release() { if ( beanInstance == null ) { return; } try { if ( injectionTarget == null ) { // todo : BeanInstanceProducer#release? return; } injectionTarget.preDestroy( beanInstance ); injectionTarget.dispose( beanInstance ); this.creationalContext.release(); } catch (Exception ignore) { } finally { this.beanInstance = null; this.creationalContext = null; this.injectionTarget = null; } } }
this.creationalContext.release();
this.creationalContext.release();
@Override public Object processInvocation(final InterceptorContext context) throws Exception { final ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class); final InterceptorInstances interceptorInstances = interceptorSupport.getInterceptorInstances(componentInstance); final InterceptorBindings interceptorBindings = interceptorBindingsSupplier.get(); switch (interceptionType) { case AROUND_INVOKE: return doMethodInterception(context.getInvocationContext(), InterceptionType.AROUND_INVOKE, interceptorInstances, interceptorBindings); case AROUND_TIMEOUT: return doMethodInterception(context.getInvocationContext(), InterceptionType.AROUND_TIMEOUT, interceptorInstances, interceptorBindings); case PRE_DESTROY: try { return doLifecycleInterception(context, interceptorInstances, interceptorBindings); } finally { interceptorInstances.getCreationalContext().release(); } case POST_CONSTRUCT: return doLifecycleInterception(context, interceptorInstances, interceptorBindings); case AROUND_CONSTRUCT: return doLifecycleInterception(context, interceptorInstances, interceptorBindings); default: //should never happen return context.proceed(); } }
protected void release(CreationalContext<?> creationalContext) { try { creationalContext.release(); } catch(Exception e) { LOG.log(Level.WARNING, "Exception while releasing CDI creational context "+e.getMessage(), e); } }
@Override public void destroy(final ExtensionManagerBus instance, final CreationalContext< ExtensionManagerBus > ctx) { injectionTarget.preDestroy(instance); injectionTarget.dispose(instance); instance.shutdown(); ctx.release(); } }