All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nitorcreations.willow.deployer.GetList Maven / Gradle / Ivy

There is a newer version: 2.0.2
Show newest version
package com.nitorcreations.willow.deployer;

import static com.nitorcreations.willow.deployer.PropertyKeys.ENV_DEPLOYER_NAME;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;

import javax.inject.Singleton;

import org.hyperic.sigar.SigarException;

@Singleton
public class GetList extends DeployerControl {
  public static void main(String[] args) {
    injector.getInstance(GetList.class).doMain(args);
  }

  public void doMain(String[] args) {
    try {
      List firstPids;
      if (args.length > 0) {
        firstPids = new ArrayList<>();
        for (String next : args) {
          long nextPid = findOldDeployerPid(next);
          if (nextPid > 0) {
            firstPids.add(nextPid);
          }
        }
      } else {
        firstPids = findOldDeployerPids();
      }
      for (long next : firstPids) {
        System.out.println(getOldDeployerName(next));
      }
    } catch (Throwable e) {
      log.log(Level.WARNING, "Failed to connect to deployer " + deployerName);
    }
  }
  protected String getOldDeployerName(long pid) throws SigarException {
    return sigar.getProcEnv(pid, ENV_DEPLOYER_NAME);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy