@Test public void testSetFactory() throws Exception { ReconfigurableClientDm client = new ReconfigurableClientDm(); final MessagingClientFactoryRegistry registry1 = new MessagingClientFactoryRegistry(); ConcurrentLinkedQueue<?> listeners1 = TestUtils.getInternalField( registry1, "listeners", ConcurrentLinkedQueue.class ); Assert.assertEquals( 0, listeners1.size()); Assert.assertNull( TestUtils.getInternalField( client, "registry", MessagingClientFactoryRegistry.class )); client.setRegistry( registry1 ); Assert.assertEquals( 1, listeners1.size()); Assert.assertEquals( registry1, TestUtils.getInternalField( client, "registry", MessagingClientFactoryRegistry.class )); final MessagingClientFactoryRegistry registry2 = new MessagingClientFactoryRegistry(); ConcurrentLinkedQueue<?> listeners2 = TestUtils.getInternalField( registry2, "listeners", ConcurrentLinkedQueue.class ); Assert.assertEquals( 0, listeners2.size()); client.setRegistry( registry2 ); Assert.assertEquals( 0, listeners1.size()); Assert.assertEquals( 1, listeners2.size()); Assert.assertEquals( registry2, TestUtils.getInternalField( client, "registry", MessagingClientFactoryRegistry.class )); }
public synchronized void setRegistry( MessagingClientFactoryRegistry registry ) { if( this.registry != null ) this.registry.removeListener(this); this.registry = registry; if (registry != null) registry.addListener(this); }
ReconfigurableClient implements IClient, MessagingClientFactoryListener { public synchronized void setRegistry( MessagingClientFactoryRegistry registry ) { if( this.registry != null ) this.registry.removeListener(this); this.registry = registry; if (registry != null) registry.addListener(this); } }
ReconfigurableClient implements IClient, MessagingClientFactoryListener { public synchronized void setRegistry( MessagingClientFactoryRegistry registry ) { if( this.registry != null ) this.registry.removeListener(this); this.registry = registry; if (registry != null) registry.addListener(this); } protected  ReconfigurableClient(); }
ReconfigurableClient implements IClient, MessagingClientFactoryListener { public synchronized void setRegistry( MessagingClientFactoryRegistry registry ) { if( this.registry != null ) this.registry.removeListener(this); this.registry = registry; if (registry != null) registry.addListener(this); } protected  ReconfigurableClient(); @Override void setDomain( String domain ); @Override String getDomain(); synchronized MessagingClientFactoryRegistry getRegistry(); synchronized void setRegistry( MessagingClientFactoryRegistry registry ); static MessagingClientFactoryRegistry lookupMessagingClientFactoryRegistryService( OsgiHelper osgiHelper ); @Override synchronized String getMessagingType(); void switchMessagingType( String factoryName ); @Override void addMessagingClientFactory( final IMessagingClientFactory factory ); @Override void removeMessagingClientFactory( IMessagingClientFactory factory ); @Override Map<String,String> getConfiguration(); abstract RecipientKind getOwnerKind(); void associateMessageProcessor( AbstractMessageProcessor<T> messageProcessor ); AbstractMessageProcessor<T> getMessageProcessor(); synchronized boolean hasValidClient(); IMessagingClient getMessagingClient(); }
ReconfigurableClient implements IClient, MessagingClientFactoryListener { public synchronized void setRegistry( MessagingClientFactoryRegistry registry ) { if( this.registry != null ) this.registry.removeListener(this); this.registry = registry; if (registry != null) registry.addListener(this); } protected  ReconfigurableClient(); @Override void setDomain( String domain ); @Override String getDomain(); synchronized MessagingClientFactoryRegistry getRegistry(); synchronized void setRegistry( MessagingClientFactoryRegistry registry ); static MessagingClientFactoryRegistry lookupMessagingClientFactoryRegistryService( OsgiHelper osgiHelper ); @Override synchronized String getMessagingType(); void switchMessagingType( String factoryName ); @Override void addMessagingClientFactory( final IMessagingClientFactory factory ); @Override void removeMessagingClientFactory( IMessagingClientFactory factory ); @Override Map<String,String> getConfiguration(); abstract RecipientKind getOwnerKind(); void associateMessageProcessor( AbstractMessageProcessor<T> messageProcessor ); AbstractMessageProcessor<T> getMessageProcessor(); synchronized boolean hasValidClient(); IMessagingClient getMessagingClient();  }