code: private Client getClient() {
          Client client = hostMap.get(basePath);
          if (client!=null) return client;
  
          final ClientConfig clientConfig = new ClientConfig();
          clientConfig.register(MultiPartFeature.class);
          if (debug) {
              clientConfig.register(LoggingFilter.class);
          }
          client = ClientBuilder.newClient(clientConfig);
  
          hostMap.putIfAbsent(basePath, client);
          return hostMap.get(basePath); //be sure to use the same in case of a race condition.
      }
docs: Get an existing client or create a new client to handle HTTP request.