@Test public void testClose() throws ProducerException, InterruptedException { LogProducerProvider producerProvider = new LogProducerProvider( "test-project", "test-endpoint", "test-ak", "test-secret", 1, 100); LogProducer producer = Mockito.mock(LogProducer.class); Whitebox.setInternalState(producerProvider, "client", producer); Mockito.doThrow(new InterruptedException()).doNothing().when(producer).close(); producerProvider.closeClient(); Mockito.verify(producer, Mockito.times(2)).close(); }
@Override protected void closeClient() { if (client != null) { while (true) { try { client.close(); break; } catch (InterruptedException e) { } catch (ProducerException e) { LOGGER.warn("Exception caught when closing client", e); break; } } client = null; } }
LogProducerProvider extends AbstractClientProvider<LogProducer> { @Override protected void closeClient() { if (client != null) { while (true) { try { client.close(); break; } catch (InterruptedException e) { } catch (ProducerException e) { LOGGER.warn("Exception caught when closing client", e); break; } } client = null; } } }
LogProducerProvider extends AbstractClientProvider<LogProducer> { @Override protected void closeClient() { if (client != null) { while (true) { try { client.close(); break; } catch (InterruptedException e) { } catch (ProducerException e) { LOGGER.warn("Exception caught when closing client", e); break; } } client = null; } } LogProducerProvider(
			String projectName, String endPoint, String accessId, String accessKey, int maxRetryTimes, int flushInterval);  LogProducerProvider(String projectName, String endPoint, Configuration properties, int maxRetryTimes, int flushInterval); }
LogProducerProvider extends AbstractClientProvider<LogProducer> { @Override protected void closeClient() { if (client != null) { while (true) { try { client.close(); break; } catch (InterruptedException e) { } catch (ProducerException e) { LOGGER.warn("Exception caught when closing client", e); break; } } client = null; } } LogProducerProvider(
			String projectName, String endPoint, String accessId, String accessKey, int maxRetryTimes, int flushInterval);  LogProducerProvider(String projectName, String endPoint, Configuration properties, int maxRetryTimes, int flushInterval);  }
LogProducerProvider extends AbstractClientProvider<LogProducer> { @Override protected void closeClient() { if (client != null) { while (true) { try { client.close(); break; } catch (InterruptedException e) { } catch (ProducerException e) { LOGGER.warn("Exception caught when closing client", e); break; } } client = null; } } LogProducerProvider(
			String projectName, String endPoint, String accessId, String accessKey, int maxRetryTimes, int flushInterval);  LogProducerProvider(String projectName, String endPoint, Configuration properties, int maxRetryTimes, int flushInterval);   }