code: private void scheduleWithRetries(CompletableFuture<Void> result,
                                       long delay,
                                       int remainingRetries,
                                       String endpointUrl,
                                       String channelId) {
          if (remainingRetries <= 0) {
              result.completeExceptionally(new JoynrRuntimeException("Unable to register channel. Too many unsuccessful retries."));
          } else {
              LOG.debug("Scheduling execution of HTTP post for registering endpoint {} for channel {}.",
                        endpointUrl,
                        channelId);
              scheduledExecutorService.schedule(() -> {
                  String topic = channelId;
                  HttpPost message = new HttpPost(endpointRegistryUri);
                  message.addHeader("Content-Type", MediaType.APPLICATION_JSON);
                  try {
                      HttpEntity entity = new StringEntity(format("{\"endpointUrl\": \"%s\", \"topic\": \"%s\"}",
                                                                  endpointUrl,
                                                                  topic));
                      message.setEntity(entity);
                      boolean executionResult = executeRequest(message);
                      if (executionResult) {
                          result.complete(null);
                          return;
                      }
                  } catch (IOException e) {
                      LOG.error(format("Unable to register endpoint %s / channel ID %s with broker at %s.",
                                       endpointUrl,
                                       channelId,
                                       endpointRegistryUri),
                                e);
                  }
                  scheduleWithRetries(result, 10L, remainingRetries - 1, endpointUrl, channelId);
              }, delay, TimeUnit.SECONDS);
          }
      }
docs: This method uses the {@link #scheduledExecutorService} in order to schedule an attempt to register the
  endpointUrl and channelId (topic) with the registration service HTTP ReST endpoint. If there is a problem with
  the attempt, then up-to 'remainingRetries' attempts will be made, by calling this method again from within the
  scheduled action.<br>
  Once the registration is successful or the number of retries runs out, then the passed in
  <code>CompletableFuture</code> is completed, so that any subsequent actions / error handling can be triggered.
  
  @param result
  the completable future which will be completed upon success or we run out of retries.
  @param delay
  the delay for scheduling the action with the {@link #scheduledExecutorService}.
  @param remainingRetries
  the remaining number of retries we can attempt on any errors during registration.
  @param endpointUrl
  the endpoint URL to be registered.
  @param channelId
  the channel ID to be registered.