/** * Responsible for instantiating the {@link BasicComponentInstance}. This method is *not* responsible for * handling the post construct activities like injection and lifecycle invocation. That is handled by * {@link #constructComponentInstance(org.jboss.as.naming.ManagedReference, boolean)}. * <p/> * * @return the component instance */ protected BasicComponentInstance instantiateComponentInstance(final Interceptor preDestroyInterceptor, final Map<Method, Interceptor> methodInterceptors, Map<Object, Object> context) { // create and return the component instance return new BasicComponentInstance(this, preDestroyInterceptor, methodInterceptors); }
/** * {@inheritDoc} */ public final void destroy() { if (doneUpdater.compareAndSet(this, 0, 1)) try { preDestroy(); final Object instance = getInstance(); if (instance != null) { final InterceptorContext interceptorContext = prepareInterceptorContext(); interceptorContext.setTarget(instance); interceptorContext.putPrivateData(InvocationType.class, InvocationType.PRE_DESTROY); preDestroy.processInvocation(interceptorContext); } } catch (Exception e) { ROOT_LOGGER.componentDestroyFailure(e, this); } finally { component.finishDestroy(); } }
/** * Wraps an existing object instance in a ComponentInstance, and run the post construct interceptor chain on it. * * @param instance The instance to wrap * @return The new ComponentInstance */ public ComponentInstance createInstance(Object instance) { BasicComponentInstance obj = constructComponentInstance(new ImmediateManagedReference(instance), true); obj.constructionFinished(); return obj; }
/** * {@inheritDoc} */ public final void destroy() { if (doneUpdater.compareAndSet(this, 0, 1)) try { preDestroy(); final ManagedReference reference = instanceReference.get(); if (reference != null) { final InterceptorContext interceptorContext = prepareInterceptorContext(); interceptorContext.setTarget(reference.getInstance()); interceptorContext.putPrivateData(InvocationType.class, InvocationType.PRE_DESTROY); preDestroy.processInvocation(interceptorContext); } } catch (Exception e) { ROOT_LOGGER.componentDestroyFailure(e, this); } finally { component.finishDestroy(); } }
@Override public void stop() { if (wsComponentInstance == null) return; synchronized(lock) { if (wsComponentInstance != null) { wsComponentInstance.destroy(); wsComponentInstance = null; } } } }
/** * {@inheritDoc} */ public Object getInstance() { ManagedReference managedReference = (ManagedReference) getInstanceData(INSTANCE_KEY); if(managedReference == null) { //can happen if around construct chain returns null return null; } return managedReference.getInstance(); }
basicComponentInstance.setInstanceData(BasicComponentInstance.INSTANCE_KEY, instance);
@Override public EJBComponent getComponent() { return (EJBComponent) super.getComponent(); }
@Override public void stop() { if (wsComponentInstance == null) return; synchronized(lock) { if (wsComponentInstance != null) { wsComponentInstance.destroy(); wsComponentInstance = null; } } } }
/** * {@inheritDoc} */ public Object getInstance() { ManagedReference managedReference = (ManagedReference) getInstanceData(INSTANCE_KEY); if(managedReference == null) { //can happen if around construct chain returns null return null; } return managedReference.getInstance(); }
basicComponentInstance.setInstanceData(BasicComponentInstance.INSTANCE_KEY, instance);
@Override public EJBComponent getComponent() { return (EJBComponent) super.getComponent(); }
/** * {@inheritDoc} */ public final void destroy() { if (doneUpdater.compareAndSet(this, 0, 1)) try { preDestroy(); final Object instance = getInstance(); if (instance != null) { final InterceptorContext interceptorContext = prepareInterceptorContext(); interceptorContext.setTarget(instance); interceptorContext.putPrivateData(InvocationType.class, InvocationType.PRE_DESTROY); preDestroy.processInvocation(interceptorContext); } } catch (Exception e) { ROOT_LOGGER.componentDestroyFailure(e, this); } finally { component.finishDestroy(); } }
/** * Responsible for instantiating the {@link BasicComponentInstance}. This method is *not* responsible for * handling the post construct activities like injection and lifecycle invocation. That is handled by * {@link #constructComponentInstance(org.jboss.as.naming.ManagedReference, boolean)}. * <p/> * * @return the component instance */ protected BasicComponentInstance instantiateComponentInstance(final Interceptor preDestroyInterceptor, final Map<Method, Interceptor> methodInterceptors, Map<Object, Object> context) { // create and return the component instance return new BasicComponentInstance(this, preDestroyInterceptor, methodInterceptors); }
@Override public void stop() { if (wsComponentInstance == null) return; synchronized(lock) { if (wsComponentInstance != null) { wsComponentInstance.destroy(); wsComponentInstance = null; } } } }
/** * {@inheritDoc} */ public Object getInstance() { ManagedReference managedReference = (ManagedReference) getInstanceData(INSTANCE_KEY); if(managedReference == null) { //can happen if around construct chain returns null return null; } return managedReference.getInstance(); }
/** * Wraps an existing object instance in a ComponentInstance, and run the post construct interceptor chain on it. * * @param instance The instance to wrap * @return The new ComponentInstance */ public ComponentInstance createInstance(Object instance) { BasicComponentInstance obj = constructComponentInstance(new ImmediateManagedReference(instance), true); obj.constructionFinished(); return obj; }
basicComponentInstance.setInstanceData(BasicComponentInstance.INSTANCE_KEY, instance);
/** * {@inheritDoc} */ public final void destroy() { if (doneUpdater.compareAndSet(this, 0, 1)) try { preDestroy(); final Object instance = getInstance(); if (instance != null) { final InterceptorContext interceptorContext = prepareInterceptorContext(); interceptorContext.setTarget(instance); interceptorContext.putPrivateData(InvocationType.class, InvocationType.PRE_DESTROY); preDestroy.processInvocation(interceptorContext); } } catch (Exception e) { ROOT_LOGGER.componentDestroyFailure(e, this); } finally { component.finishDestroy(); } }
/** * Responsible for instantiating the {@link BasicComponentInstance}. This method is *not* responsible for * handling the post construct activities like injection and lifecycle invocation. That is handled by * {@link #constructComponentInstance(ManagedReference, boolean, InterceptorFactoryContext)}. * <p/> * * @return the component instance */ protected BasicComponentInstance instantiateComponentInstance(final AtomicReference<ManagedReference> instanceReference, final Interceptor preDestroyInterceptor, final Map<Method, Interceptor> methodInterceptors, final InterceptorFactoryContext context) { // create and return the component instance return new BasicComponentInstance(this, instanceReference, preDestroyInterceptor, methodInterceptors); }