javax.enterprise.inject.spi.Producer.dispose()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中javax.enterprise.inject.spi.Producer.dispose()方法的一些代码示例,展示了Producer.dispose()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Producer.dispose()方法的具体详情如下:
包路径:javax.enterprise.inject.spi.Producer
类名称:Producer
方法名:dispose

Producer.dispose介绍

[英]Destroys the instance.

If the Producer represents a class, then this operation does nothing.

If the Producer represents a producer field or method, this calls the disposer method, if any, on a contextual instance of the bean that declares the disposer method or performs any additional required cleanup, if any, to destroy state associated with a resource.
[中]销毁实例。
如果生产者代表一个类,那么这个操作什么都不做。
如果Producer表示Producer字段或方法,则会在bean的上下文实例上调用disposer方法(如果有),该实例声明disposer方法或执行任何额外的必需清理(如果有),以销毁与资源关联的状态。

代码示例

代码示例来源:origin: org.apache.deltaspike.modules/deltaspike-test-control-module-impl

@Override
public void dispose(T instance)
{
  wrapped.dispose(instance);
}

代码示例来源:origin: org.infinispan/infinispan-cdi

@Override
 public void destroy(Bean<RemoteCache<?, ?>> bean, RemoteCache<?, ?> instance, CreationalContext<RemoteCache<?, ?>> ctx) {
   remoteCacheProducer.dispose(instance);
 }
}).create());

代码示例来源:origin: org.wildfly.swarm/container

@Override
public void dispose(T instance) {
  delegate.dispose(instance);
}

代码示例来源:origin: io.thorntail/container

@Override
public void dispose(T instance) {
  delegate.dispose(instance);
}

代码示例来源:origin: org.infinispan/infinispan-cdi-remote

@Override
  public void destroy(Bean<RemoteCache<?, ?>> bean, RemoteCache<?, ?> instance, CreationalContext<RemoteCache<?, ?>> ctx) {
    remoteCacheProducer.dispose(instance);
  }
}).create());

代码示例来源:origin: org.jboss.weld.servlet/weld-servlet-shaded

@Override
public void destroy(T instance, CreationalContext<T> creationalContext) {
  try {
    getProducer().dispose(instance);
  } finally {
    creationalContext.release();
  }
}

代码示例来源:origin: weld/core

/**
 *
 * @param producer
 */
public ProducerConfiguratorImpl(Producer<T> producer) {
  this.produceCallback = (c) -> producer.produce(c);
  this.disposeCallback = (i) -> producer.dispose(i);
  this.injectionPoints = producer.getInjectionPoints();
}

代码示例来源:origin: weld/core

@Override
public void destroy(T instance, CreationalContext<T> creationalContext) {
  try {
    getProducer().dispose(instance);
  } finally {
    creationalContext.release();
  }
}

代码示例来源:origin: weld/core

@Override
public void destroy(T instance, CreationalContext<T> creationalContext) {
  try {
    getProducer().dispose(instance);
  } finally {
    creationalContext.release();
  }
}

代码示例来源:origin: weld/core

/**
 *
 * @param producer
 */
public ProducerConfiguratorImpl(Producer<T> producer) {
  this.produceCallback = (c) -> producer.produce(c);
  this.disposeCallback = (i) -> producer.dispose(i);
  this.injectionPoints = producer.getInjectionPoints();
}

代码示例来源:origin: weld/core

@Override
public void destroy(T instance, CreationalContext<T> creationalContext) {
  try {
    getProducer().dispose(instance);
  } finally {
    creationalContext.release();
  }
}

代码示例来源:origin: org.jboss.weld.se/weld-se-shaded

/**
 *
 * @param producer
 */
public ProducerConfiguratorImpl(Producer<T> producer) {
  this.produceCallback = (c) -> producer.produce(c);
  this.disposeCallback = (i) -> producer.dispose(i);
  this.injectionPoints = producer.getInjectionPoints();
}

代码示例来源:origin: org.jboss.weld.se/weld-se-shaded

@Override
public void destroy(T instance, CreationalContext<T> creationalContext) {
  try {
    getProducer().dispose(instance);
  } finally {
    creationalContext.release();
  }
}

代码示例来源:origin: org.jboss.weld.servlet/weld-servlet-shaded

/**
 *
 * @param producer
 */
public ProducerConfiguratorImpl(Producer<T> producer) {
  this.produceCallback = (c) -> producer.produce(c);
  this.disposeCallback = (i) -> producer.dispose(i);
  this.injectionPoints = producer.getInjectionPoints();
}

代码示例来源:origin: org.jboss.weld.se/weld-se

@Override
public void destroy(T instance, CreationalContext<T> creationalContext) {
  try {
    getProducer().dispose(instance);
  } finally {
    creationalContext.release();
  }
}

代码示例来源:origin: weld/core

/**
 *
 * @param producer
 */
public ProducerConfiguratorImpl(Producer<T> producer) {
  this.produceCallback = (c) -> producer.produce(c);
  this.disposeCallback = (i) -> producer.dispose(i);
  this.injectionPoints = producer.getInjectionPoints();
}

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

@Test
@SpecAssertions({ @SpecAssertion(section = INJECTIONTARGET, id = "faa") })
public void testProducerForMethodDisposesProduct() {
  Bean<Dog> dogBean = getUniqueBean(Dog.class, new AnnotationLiteral<Noisy>() {
  });
  Producer<Dog> producer = ProducerProcessor.getNoisyDogProducer();
  DogProducer.reset();
  Dog dog = producer.produce(getCurrentManager().createCreationalContext(dogBean));
  assert DogProducer.isNoisyDogProducerCalled();
  producer.dispose(dog);
  assert DogProducer.isNoisyDogDisposerCalled();
}

代码示例来源:origin: org.jboss.weld.servlet/weld-servlet-shaded

public void destroy(T instance, CreationalContext<T> creationalContext) {
  super.destroy(instance, creationalContext);
  try {
    getProducer().dispose(instance);
  } catch (Exception e) {
    BeanLogger.LOG.errorDestroying(instance, this);
    BeanLogger.LOG.catchingDebug(e);
  } finally {
    if (getDeclaringBean().isDependent()) {
      creationalContext.release();
    }
  }
}

代码示例来源:origin: org.jboss.weld.se/weld-se

public void destroy(T instance, CreationalContext<T> creationalContext) {
  super.destroy(instance, creationalContext);
  try {
    getProducer().dispose(instance);
  } catch (Exception e) {
    BeanLogger.LOG.errorDestroying(instance, this);
    BeanLogger.LOG.catchingDebug(e);
  } finally {
    if (getDeclaringBean().isDependent()) {
      creationalContext.release();
    }
  }
}

代码示例来源:origin: weld/core

public void destroy(T instance, CreationalContext<T> creationalContext) {
  super.destroy(instance, creationalContext);
  try {
    getProducer().dispose(instance);
  } catch (Exception e) {
    BeanLogger.LOG.errorDestroying(instance, this);
    BeanLogger.LOG.catchingDebug(e);
  } finally {
    if (getDeclaringBean().isDependent()) {
      creationalContext.release();
    }
  }
}

相关文章