code: public void shutdown() {
          if (_producer != null) {
              _producer.close();
          }
          _executorService.shutdown();
          try {
              if (!_executorService.awaitTermination(10, TimeUnit.SECONDS)) {
                  _logger.warn("Shutdown of Kafka executor service timed out after 10 seconds.");
                  _executorService.shutdownNow();
              }
          } catch (InterruptedException ex) {
              _logger.warn("Shutdown of executor service was interrupted.");
              Thread.currentThread().interrupt();
          }
      }
docs: Shuts down the producer.