/** * <p>destroy</p> * * @throws java.lang.Exception if any. */ @Override public void destroy() throws Exception { if ( m_registration != null ) { m_registration.unregister(); } }
/** * <p>destroy</p> * * @throws java.lang.Exception if any. */ @Override public void destroy() throws Exception { for(Registration registration : m_registrations) { registration.unregister(); } }
/** * <p>destroy</p> * * @throws java.lang.Exception if any. */ @Override public void destroy() throws Exception { if ( m_registration != null ) { m_registration.unregister(); } }
private void unregisterWithOnmsRegistry(final ServiceReference<?> reference) { final Registration onmsRegistration = m_osgiReference2onmsRegistrationMap.remove(reference); if (onmsRegistration == null) return; onmsRegistration.unregister(); }
private void unregisterWithOnmsRegistry(final ServiceReference<?> reference) { final Registration onmsRegistration = m_osgiReference2onmsRegistrationMap.remove(reference); if (onmsRegistration == null) return; onmsRegistration.unregister(); }
@Override public void reloadConfig() throws NorthbounderException { LOG.info("Reloading JMS northbound configuration."); try { m_configDao.reload(); m_registrations.forEach((k,v) -> { if (k != getName()) v.unregister();}); registerNorthnounders(); } catch (Exception e) { throw new NorthbounderException("Can't reload the JMS northbound configuration", e); } }
/** * Reloads the configuration. */ @Override public void reloadConfig() throws NorthbounderException { LOG.info("Reloading SNMP Traps northbound configuration."); try { m_configDao.reload(); m_registrations.forEach((k,v) -> { if (k != getName()) v.unregister();}); registerNorthnounders(); } catch (Exception e) { throw new NorthbounderException("Can't reload the SNMP trap northbound configuration", e); } }
/** * Reloads the configuration. */ @Override public void reloadConfig() throws NorthbounderException { // FIXME As this can be expensive, I would say do it on a per-engine basis LOG.info("Reloading BSF northbound configuration."); try { m_configDao.reload(); m_registrations.forEach((k,v) -> { if (k != getName()) v.unregister();}); registerNorthnounders(); } catch (Exception e) { throw new NorthbounderException("Can't reload the BSF trap northbound configuration", e); } }
/** * Reloads the configuration. */ @Override public void reloadConfig() throws NorthbounderException { // FIXME As this can be expensive, I would say do it on a per-engine basis LOG.info("Reloading BSF northbound configuration."); try { m_configDao.reload(); m_registrations.forEach((k,v) -> { if (k != getName()) v.unregister();}); registerNorthnounders(); } catch (Exception e) { throw new NorthbounderException("Can't reload the BSF trap northbound configuration", e); } }
/** * Reloads the configuration. */ @Override public void reloadConfig() throws NorthbounderException { // FIXME As this can be expensive, I would say do it on a per-engine basis LOG.info("Reloading Drools northbound configuration."); try { m_configDao.reload(); m_registrations.forEach((k,v) -> { if (k != getName()) v.unregister();}); registerNorthnounders(); } catch (Exception e) { throw new NorthbounderException("Can't reload the Drools northbound configuration", e); } }
/** * Reloads the configuration. */ @Override public void reloadConfig() throws NorthbounderException { LOG.info("Reloading Syslog northbound configuration."); try { m_configDao.reload(); m_registrations.forEach((k,v) -> { if (k != getName()) v.unregister();}); // Unregistering Syslog destinations Syslog.shutdown(); // Shutdown all Syslog instances. registerNorthnounders(); // Re-registering all Syslog destinations. } catch (Exception e) { throw new NorthbounderException("Can't reload the Syslog northbound configuration", e); } } }
/** * Reloads the configuration. */ @Override public void reloadConfig() { LOG.info("Reloading Email northbound configuration."); try { m_configDao.reload(); m_javaMailDao.reloadConfiguration(); m_registrations.forEach((k,v) -> { if (k != getName()) v.unregister();}); registerNorthnounders(); } catch (Exception e) { throw new NorthbounderException("Can't reload the SNMP trap northbound configuration", e); } }
/** * Reloads the configuration. */ @Override public void reloadConfig() { LOG.info("Reloading Email northbound configuration."); try { m_configDao.reload(); m_javaMailDao.reloadConfiguration(); m_registrations.forEach((k,v) -> { if (k != getName()) v.unregister();}); registerNorthnounders(); } catch (Exception e) { throw new NorthbounderException("Can't reload the SNMP trap northbound configuration", e); } }
@Test @DirtiesContext public void testFilteredReferenceListBeanDefinition() { assertNotNull(m_bigGoodbyeList); int expected = m_bigGoodbyeList.size() + 1; Map<String, String> bigProps = new HashMap<String, String>(); bigProps.put("size", "big"); Registration bigRegistration = m_defaultServiceRegistry.register(new MyProvider("alsoBig"), bigProps, Goodbye.class); Map<String, String> props = new HashMap<String, String>(); props.put("size", "small"); Registration smallRegistration = m_defaultServiceRegistry.register(new MyProvider("alsoSmall"), props, Goodbye.class); assertEquals(expected, m_bigGoodbyeList.size()); expected = m_bigGoodbyeList.size() - 1; bigRegistration.unregister(); smallRegistration.unregister(); assertEquals(expected, m_bigGoodbyeList.size()); }
@Test @DirtiesContext public void testReferenceListBeanDefinition() { assertNotNull(m_helloList); int expected = m_helloList.size() + 1; Registration registration = m_defaultServiceRegistry.register(new MyProvider(), Hello.class); assertEquals(expected, m_helloList.size()); expected = m_helloList.size() - 1; registration.unregister(); assertEquals(expected, m_helloList.size()); }
reg2.unregister(); reg1.unregister(); reg3.unregister();
assertSame(provider, goodbyes.iterator().next()); registration.unregister();
reg2.unregister(); reg1.unregister(); reg3.unregister();
@Test @DirtiesContext public void testRegistrationListenerBeanDefinition() { assertNotNull(m_helloListListener); MyProvider myProvider = new MyProvider(); int expected = m_helloListListener.getTotalProviders() + 1; Registration registration = m_defaultServiceRegistry.register(myProvider, Hello.class); assertEquals(expected, m_helloListListener.getTotalProviders()); expected = m_helloListListener.getTotalProviders() - 1; registration.unregister(); assertEquals(expected, m_helloListListener.getTotalProviders()); }
@Test public void testRegistrationListener() { Listener<Hello> helloListener = new Listener<>(); Listener<Goodbye> goodbyeListener = new Listener<>(); m_registry.addListener(Hello.class, helloListener); m_registry.addListener(Goodbye.class, goodbyeListener); MyProvider provider = new MyProvider(); Registration registration = m_registry.register(provider, Hello.class, Goodbye.class); assertEquals(1, helloListener.size()); assertEquals(1, goodbyeListener.size()); assertTrue(helloListener.contains(provider)); assertTrue(goodbyeListener.contains(provider)); registration.unregister(); assertEquals(0, helloListener.size()); assertEquals(0, goodbyeListener.size()); }