@Test public void testTerminateClient_1() throws Exception { Logger logger = Logger.getLogger( getClass().getName()); IMessagingClient client = Mockito.mock( IMessagingClient.class ); ReconfigurableClient.terminateClient( client, "", logger ); Mockito.verify( client, Mockito.only()).closeConnection(); }
static void terminateClient( IMessagingClient client, String errorMessage, Logger logger ) { try { logger.fine( "The reconfigurable client is requesting its internal connection to be closed." ); if( client != null ) client.closeConnection(); } catch( Exception e ) { logger.warning( errorMessage + " " + e.getMessage()); Utils.logException( logger, e ); } finally { if( client instanceof JmxWrapperForMessagingClient ) ((JmxWrapperForMessagingClient) client).unregisterService(); } }
ReconfigurableClient implements IClient, MessagingClientFactoryListener { static void terminateClient( IMessagingClient client, String errorMessage, Logger logger ) { try { logger.fine( "The reconfigurable client is requesting its internal connection to be closed." ); if( client != null ) client.closeConnection(); } catch( Exception e ) { logger.warning( errorMessage + " " + e.getMessage()); Utils.logException( logger, e ); } finally { if( client instanceof JmxWrapperForMessagingClient ) ((JmxWrapperForMessagingClient) client).unregisterService(); } } }
ReconfigurableClient implements IClient, MessagingClientFactoryListener { static void terminateClient( IMessagingClient client, String errorMessage, Logger logger ) { try { logger.fine( "The reconfigurable client is requesting its internal connection to be closed." ); if( client != null ) client.closeConnection(); } catch( Exception e ) { logger.warning( errorMessage + " " + e.getMessage()); Utils.logException( logger, e ); } finally { if( client instanceof JmxWrapperForMessagingClient ) ((JmxWrapperForMessagingClient) client).unregisterService(); } } protected  ReconfigurableClient(); }
ReconfigurableClient implements IClient, MessagingClientFactoryListener { static void terminateClient( IMessagingClient client, String errorMessage, Logger logger ) { try { logger.fine( "The reconfigurable client is requesting its internal connection to be closed." ); if( client != null ) client.closeConnection(); } catch( Exception e ) { logger.warning( errorMessage + " " + e.getMessage()); Utils.logException( logger, e ); } finally { if( client instanceof JmxWrapperForMessagingClient ) ((JmxWrapperForMessagingClient) client).unregisterService(); } } 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 { static void terminateClient( IMessagingClient client, String errorMessage, Logger logger ) { try { logger.fine( "The reconfigurable client is requesting its internal connection to be closed." ); if( client != null ) client.closeConnection(); } catch( Exception e ) { logger.warning( errorMessage + " " + e.getMessage()); Utils.logException( logger, e ); } finally { if( client instanceof JmxWrapperForMessagingClient ) ((JmxWrapperForMessagingClient) client).unregisterService(); } } 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();  }