private List<List<Object>> deployJars(List<String> jarFullPaths,
      Set<DistributedMember> targetMembers,
      List<List<Object>> results,
      RemoteStreamExporter exporter)
      throws FileNotFoundException, java.rmi.RemoteException {
    for (DistributedMember member : targetMembers) {
      List<RemoteInputStream> remoteStreams = new ArrayList<>();
      List<String> jarNames = new ArrayList<>();
      try {
        for (String jarFullPath : jarFullPaths) {
          FileInputStream fileInputStream = null;
          try {
            fileInputStream = new FileInputStream(jarFullPath);
            remoteStreams.add(exporter.export(new SimpleRemoteInputStream(fileInputStream)));
            jarNames.add(FilenameUtils.getName(jarFullPath));
          } catch (Exception ex) {
            if (fileInputStream != null) {
              try {
                fileInputStream.close();
              } catch (IOException ignore) {
              }
            }
            throw ex;
          }
        }

        // this deploys the jars to all the matching servers
        ResultCollector<?, ?> resultCollector =
            executeFunction(deployFunction,
                new Object[] {jarNames, remoteStreams}, member);

        @SuppressWarnings("unchecked")
        final List<List<Object>> resultCollectorResult =
            (List<List<Object>>) resultCollector.getResult();
        results.add(resultCollectorResult.get(0));
      } finally {
        for (RemoteInputStream ris : remoteStreams) {
          try {
            ris.close(true);
          } catch (IOException ex) {
            // Ignored. the stream may have already been closed.
          }
        }
      }
    }
    return results;
  }
Deploy one or more JAR files to members of a group or all members.

@param groups Group(s) to deploy the JAR to or null for all members
@param jars JAR file to deploy
@param dir Directory of JAR files to deploy
@return The result of the attempt to deploy
geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/DeployCommand.java