@Override
  public synchronized ServiceResult<Deployment> deploy(Deployment deployment) {
    try {
      DeployedJar deployedJar = jarDeployer.deploy(deployment.getFile());
      // This means that the jars are already deployed, so we call it a Success.
      if (deployedJar == null) {
        logger.info("Jar already been deployed: {}", deployment);
        // null is returned when already deployed to satisfy existing public API constraints
        return Success.of(null);
      } else {
        // This will only iterate once since deploy is given a singleton list.
        logger.debug("Adding Deployment: {} with DeployedJar: {}", deployment, deployedJar);
        Deployment deploymentCopy = new Deployment(deployment, deployedJar.getFile());
        deploymentCopy.setDeployedTime(Instant.now().toString());
        deployments.put(JarFileUtils.getArtifactId(deploymentCopy.getFileName()), deploymentCopy);
        logger.debug("Deployments List size after add: {}", deployments.size());
        logger.debug("Deployment copy to return: {}", deploymentCopy);
        try {
          functionToFileTracker.registerFunctionsFromFile(deploymentCopy.getFile());
        } catch (ClassNotFoundException | IOException e) {
          jarDeployer.undeploy(JarFileUtils.getArtifactId(deployment.getFileName()));
          return Failure.of(e);
        }
        return Success.of(deploymentCopy);
      }
    } catch (IOException | ClassNotFoundException e) {
      return Failure.of(e);
    } finally {
      flushCaches();
    }
  }
Implementation of {@link JarDeploymentService} that encapsulates the standard method of deploying
jars by delegating to the {@link JarDeployer}.

@since Geode 1.15
geode-deployment/geode-deployment-legacy/src/main/java/org/apache/geode/deployment/internal/legacy/LegacyJarDeploymentService.java