/** @see ConnectionFactory#refreshMetadata(Collection) */
 @Override
 public void refreshMetadata(Collection<String> topics) {
   try {
     this.lock.writeLock().lock();
     String brokerAddressesAsString =
         ListIterate.collect(this.configuration.getBrokerAddresses(), Functions.getToString())
             .makeString(",");
     Seq<Broker> brokers = null;
     try {
       brokers = ClientUtils$.MODULE$.parseBrokerList(brokerAddressesAsString);
     } catch (Exception e) {
       throw new IllegalStateException(
           "Can not parse Kafka Brokers for: [" + brokerAddressesAsString + "]", e);
     }
     TopicMetadataResponse topicMetadataResponse =
         new TopicMetadataResponse(
             ClientUtils$.MODULE$.fetchTopicMetadata(
                 JavaConversions.asScalaSet(new HashSet<>(topics)),
                 brokers,
                 this.configuration.getClientId(),
                 this.configuration.getFetchMetadataTimeout(),
                 0));
     PartitionIterable<TopicMetadata> selectWithoutErrors =
         Iterate.partition(
             topicMetadataResponse.topicsMetadata(), errorlessTopicMetadataPredicate);
     this.metadataCacheHolder.set(
         this.metadataCacheHolder.get().merge(selectWithoutErrors.getSelected()));
     if (log.isInfoEnabled()) {
       for (TopicMetadata topicMetadata : selectWithoutErrors.getRejected()) {
         log.info(
             String.format("No metadata could be retrieved for '%s'", topicMetadata.topic()),
             ErrorMapping.exceptionFor(topicMetadata.errorCode()));
       }
     }
   } finally {
     this.lock.writeLock().unlock();
   }
 }
 @Override
 public boolean accept(TopicMetadata topicMetadata) {
   return topicMetadata.errorCode() == ErrorMapping.NoError();
 }