本文整理了Java中javax.enterprise.inject.spi.Bean.destroy()
方法的一些代码示例,展示了Bean.destroy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bean.destroy()
方法的具体详情如下:
包路径:javax.enterprise.inject.spi.Bean
类名称:Bean
方法名:destroy
暂无
代码示例来源:origin: hibernate/hibernate-orm
@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;
}
}
代码示例来源:origin: jersey/jersey
@Override
@SuppressWarnings("unchecked")
public ForeignDescriptor createForeignDescriptor(Binding binding) {
Class<?> clazz;
if (ClassBinding.class.isAssignableFrom(binding.getClass())) {
clazz = ((ClassBinding<?>) binding).getService();
} else if (InstanceBinding.class.isAssignableFrom(binding.getClass())) {
clazz = ((InstanceBinding<?>) binding).getService().getClass();
} else {
throw new RuntimeException(
org.glassfish.jersey.internal.LocalizationMessages
.UNKNOWN_DESCRIPTOR_TYPE(binding.getClass().getSimpleName()));
}
Set<Bean<?>> beans = beanManager.getBeans(clazz);
if (beans.isEmpty()) {
return null;
}
Bean bean = beans.iterator().next();
CreationalContext ctx = beanManager.createCreationalContext(bean);
return ForeignDescriptor.wrap(bean, instance -> bean.destroy(instance, ctx));
}
代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl
@Override
public void destroy(T instance, CreationalContext<T> tCreationalContext)
{
bean.destroy(instance, tCreationalContext);
}
代码示例来源:origin: org.jboss.forge.furnace/container-cdi-impl
@Override
public void destroy(T instance, CreationalContext<T> creationalContext)
{
wrapped.destroy(instance, creationalContext);
}
}
代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl
@Override
public void dispose(T instance)
{
bean.destroy(instance, null);
}
代码示例来源:origin: picketlink/picketlink
@Override
public void destroy(T instance, CreationalContext<T> creationalContext)
{
wrapped.destroy(instance, creationalContext);
}
}
代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl
@Override
public void destroy(T instance, CreationalContext<T> context)
{
bean.destroy(instance,context);
}
代码示例来源:origin: com.caucho/resin
/**
* Call destroy
*/
@Override
public void destroy(T instance, CreationalContext<T> env)
{
_bean.destroy(instance, env);
}
代码示例来源:origin: org.apache.deltaspike.core/deltaspike-core-api
@Override
public void destroy(T instance, CreationalContext<T> creationalContext)
{
wrapped.destroy(instance, creationalContext);
}
}
代码示例来源:origin: com.sun.jersey/jersey-servlet
public void destroy(Object o) {
final CreationalContext cc = beanManager.createCreationalContext(b);
((Bean)b).destroy(o, cc);
}
};
代码示例来源:origin: com.sun.jersey/jersey-bundle
public void destroy(Object o) {
final CreationalContext cc = beanManager.createCreationalContext(b);
((Bean)b).destroy(o, cc);
}
};
代码示例来源:origin: errai/errai
@Override
protected void destroyProviderInstance(final RequiredRolesProvider instance) {
if (dependentProviders.containsKey(instance)) {
final BeanDef beanDef = dependentProviders.remove(instance);
beanDef.bean.destroy(instance, beanDef.creationalContext);
}
}
代码示例来源:origin: org.juzu/juzu-core
public void beforeShutdown(@Observes BeforeShutdown event, BeanManager beanManager) {
// Take care of destroying singletons
for (Bean singleton : singletons) {
CreationalContext cc = beanManager.createCreationalContext(singleton);
Object o = beanManager.getReference(singleton, singleton.getBeanClass(), cc);
singleton.destroy(o, cc);
}
}
}
代码示例来源:origin: com.caucho/resin
@Override
public void destroy(T instance, CreationalContext<T> env)
{
getBean().destroy(instance, env);
}
}
代码示例来源:origin: bessemHmidi/AngularBeans
void destroyBean(NGSessionScopeInstance customScopeInstance) {
getBeans().remove(customScopeInstance.bean.getBeanClass());
customScopeInstance.bean.destroy(customScopeInstance.instance,
customScopeInstance.ctx);
}
代码示例来源:origin: org.jboss.jsr299.tck/jsr299-tck-impl
@Test
@SpecAssertion(section = "4.2", id = "bbc")
public void testIndirectSubClassInheritsPreDestroyOnSuperclass()
{
OrderProcessor.preDestroyCalled = false;
assert getBeans(IndirectOrderProcessor.class).size() == 1;
Bean<IndirectOrderProcessor> bean = getBeans(IndirectOrderProcessor.class).iterator().next();
CreationalContext<IndirectOrderProcessor> creationalContext = getCurrentManager().createCreationalContext(bean);
IndirectOrderProcessor instance = getInstanceByType(IndirectOrderProcessor.class);
bean.destroy(instance, creationalContext);
assert OrderProcessor.preDestroyCalled;
}
代码示例来源:origin: org.jboss.jsr299.tck/jsr299-tck-impl
@Test
@SpecAssertion(section = "4.2", id = "bba")
public void testSubClassDoesNotInheritPreDestroyConstructOnSuperclassBlockedByIntermediateClass()
{
OrderProcessor.preDestroyCalled = false;
assert getBeans(NovelOrderProcessor.class).size() == 1;
Bean<NovelOrderProcessor> bean = getBeans(NovelOrderProcessor.class).iterator().next();
CreationalContext<NovelOrderProcessor> creationalContext = getCurrentManager().createCreationalContext(bean);
NovelOrderProcessor instance = getInstanceByType(NovelOrderProcessor.class);
bean.destroy(instance, creationalContext);
assert !OrderProcessor.preDestroyCalled;
}
代码示例来源:origin: org.jboss.jsr299.tck/jsr299-tck-impl
@Test(groups = { "enterpriseBeans", "lifecycle" })
@SpecAssertion(section = "5.5.3", id = "a")
public void testDependentObjectsDestroyed()
{
Bean<UniStadt> uniStadtBean = getBeans(UniStadt.class).iterator().next();
CreationalContext<UniStadt> creationalContext = getCurrentManager().createCreationalContext(uniStadtBean);
UniStadt marburg = uniStadtBean.create(creationalContext);
assert marburg != null : "Couldn't find the main SFSB";
uniStadtBean.destroy(marburg, creationalContext);
GrossStadt frankfurt = getInstanceByType(GrossStadt.class);
assert frankfurt.isSchlossDestroyed();
}
代码示例来源:origin: apache/deltaspike
/**
* This method will properly destroy the @Dependent scoped instance.
* It will have no effect if the bean is NormalScoped as those have their
* own lifecycle which we must not disrupt.
*/
public void destroy()
{
if (!BeanManagerProvider.getInstance().getBeanManager().isNormalScope(bean.getScope()))
{
bean.destroy(instance, creationalContext);
}
}
代码示例来源:origin: org.apache.deltaspike.core/deltaspike-core-api
/**
* This method will properly destroy the @Dependent scoped instance.
* It will have no effect if the bean is NormalScoped as those have their
* own lifecycle which we must not disrupt.
*/
public void destroy()
{
if (!BeanManagerProvider.getInstance().getBeanManager().isNormalScope(bean.getScope()))
{
bean.destroy(instance, creationalContext);
}
}
内容来源于网络,如有侵权,请联系作者删除!