org.jboss.errai.ioc.client.container.IOC.unregisterLifecycleListener()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(279)

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

IOC.unregisterLifecycleListener介绍

[英]Unregister a LifecycleListenerGenerator and all the LifecycleListener created by this generator.
[中]注销LifecycleListenerGenerator以及由此生成器创建的所有LifecycleListener。

代码示例

代码示例来源:origin: errai/errai

/**
 * Stops this sync worker if it is running.
 *
 * @throws IllegalStateException
 *           if this sync worker has not yet been started.
 */
public void stop() {
 if (!started)
  throw new IllegalStateException("This worker was never started");
 stopped = true;
 callbacks.clear();
 if (beanlifecycleListener != null && managedBeanInstance != null) {
  IOC.unregisterLifecycleListener(managedBeanInstance, beanlifecycleListener);
 }
 timer.cancel();
}

代码示例来源:origin: errai/errai

@SuppressWarnings("unchecked")
public void testUnregisterSingleInstanceListenerTwice() throws Exception {
 final Counter listenerCounter = new Counter();
 final LifecycleListener<Integer> listener = new CountingListener(listenerCounter);
 final Access<Integer> event = IOC.getBeanManager().lookupBean(Access.class).getInstance();
 final Integer instance = 1337;
 IOC.registerLifecycleListener(instance, listener);
 // Precondition
 assertEquals(0, listenerCounter.getValue());
 event.fireAsync(instance);
 assertEquals(1, listenerCounter.getValue());
 IOC.unregisterLifecycleListener(instance, listener);
 event.fireAsync(instance);
 assertEquals(1, listenerCounter.getValue());
 // Actual test
 try {
  IOC.unregisterLifecycleListener(instance, listener);
 }
 catch (Exception e) {
  fail("Second unregister call caused an exception: " + e.getMessage());
 }
}

代码示例来源:origin: errai/errai

@SuppressWarnings("unchecked")
public void testUnregisterSingleInstanceListenerAfterDestruction() throws Exception {
 final Counter listenerCounter = new Counter();
 final LifecycleListener<Integer> listener = new CountingListener(listenerCounter);
 final SyncBeanManager bm = IOC.getBeanManager();
 final Access<Integer> event = bm.lookupBean(Access.class).getInstance();
 final Destruction<Integer> destruction = bm.lookupBean(Destruction.class).getInstance();
 final Integer instance = 1337;
 IOC.registerLifecycleListener(instance, listener);
 // Precondition
 assertEquals(0, listenerCounter.getValue());
 event.fireAsync(instance);
 assertEquals(1, listenerCounter.getValue());
 destruction.fireAsync(instance);
 event.fireAsync(instance);
 assertEquals(1, listenerCounter.getValue());
 // Actual test
 try {
  IOC.unregisterLifecycleListener(instance, listener);
 }
 catch (Exception e) {
  fail("Unregister call caused an exception: " + e.getMessage());
 }
}

代码示例来源:origin: errai/errai

IOC.unregisterLifecycleListener(Integer.class, generator);

代码示例来源:origin: errai/errai

IOC.unregisterLifecycleListener(Integer.class, generator);

代码示例来源:origin: errai/errai

IOC.unregisterLifecycleListener(instance, listener);

相关文章