run & connect a service with given cmdline args and classes

@param args
@param serviceClazz
@param argsClazz
@return
@throws IllegalAccessException
@throws InstantiationException
555243
public static ServiceActor RunTCP( String args[], Class<? extends ServiceActor> serviceClazz, Class<? extends ServiceArgs> argsClazz) {
        ServiceActor myService = AsActor(serviceClazz);
        ServiceArgs options = null;
        try {
            options = ServiceRegistry.parseCommandLine(args, null, argsClazz.newInstance());
        } catch (Exception e) {
            FSTUtil.rethrow(e);
        }
        TCPConnectable connectable = new TCPConnectable(ServiceRegistry.class, options.getRegistryHost(), options.getRegistryPort());

        myService.init( connectable, options, true).await(30_000);
        Log.Info(myService.getClass(), "Init finished");

        return myService;
    }
316853
public static void main(String... args) {
        CommandLineRunner runner = new CommandLineRunner();

        try {
            runner.run(args);
        } catch (Exception t) {
            System.err.println(t.getMessage());
            System.err.println("Try '--help' for more information.");

            t.printStackTrace(System.err);

            System.exit(1);
        }

        System.exit(0);
    }
371599
public static void main(String[] args) throws Exception {
    ArgP argp = new ArgP();
    argp.addOption("--help", "Print help information.");
    CliOptions.addCommon(argp);
    FsckOptions.addDataOptions(argp);
    args = CliOptions.parse(argp, args);

    if (argp.has("--help")) {
      usage(argp, "", 0);
    }

    Config config = CliOptions.getConfig(argp);
    final FsckOptions options = new FsckOptions(argp, config);
    final TSDB tsdb = new TSDB(config);
    final ArrayList<Query> queries = new ArrayList<Query>();
    if (args != null && args.length > 0) {
      CliQuery.parseCommandLineQuery(args, tsdb, queries, null, null);
    }
    if (queries.isEmpty() && !argp.has("--full-scan")) {
      usage(argp, "Must supply a query or use the '--full-scan' flag", 1);
    }
    tsdb.checkNecessaryTablesExist().joinUninterruptibly();

    argp = null;
    final Fsck fsck = new Fsck(tsdb, options);
    try {
      if (!queries.isEmpty()) {
        fsck.runQueries(queries);
      } else {
        fsck.runFullTable();
      }
    } finally {
      tsdb.shutdown().joinUninterruptibly();
    }
    System.exit(fsck.totalErrors() == 0 ? 0 : 1);
  }
586163
public static void main(String[] args) {
		if (args == null || args.length == 0) {
			server = com.jfinal.server.jetty.ServerFactory.getServer();
			server.start();
			return ;
		}
		
		// for Eclipse
		if (args.length == 4) {
			String webAppDir = args[0];
			int port = Integer.parseInt(args[1]);
			String context = args[2];
			int scanIntervalSeconds = Integer.parseInt(args[3]);
			server = com.jfinal.server.jetty.ServerFactory.getServer(webAppDir, port, context, scanIntervalSeconds);
			server.start();
			return ;
		}
		
		// for IDEA
		if (args.length == 3) {
			start(args[0], Integer.parseInt(args[1]), args[2]);
			return ;
		}
		
		throw new RuntimeException("Boot parameter error. The right parameter like this: src/main/webapp 80 / 5");
	}
196147
public static final void main(String [] args) throws Exception {
        GatewayMicroService microService = new GatewayMicroService();
        microService.start();
        microService.join();
    }
136728
public Object execute(String name, MethodMetaArgs methodMetaArgs, AppContextWrapper acw) throws Exception {
		if ((methodMetaArgs == null) || (methodMetaArgs.getMethodName() == null)) {
			Debug.logWarning(" methodMetaArgs is null. cann't invoke service.execute");
		}
		Debug.logVerbose("++++++++++++++++++++++++++++++<begin: invoking from jdonframework.xml", module);
		Debug.logVerbose("+++++++++++++++execute new service='" + name + "' method='" + methodMetaArgs.getMethodName() + "'", module);
		ContainerWrapper cw = containerCallback.getContainerWrapper();
		TargetMetaDef targetMetaDef = userTargetMetaDefFactory.getTargetMetaDef(name, cw);
		if (targetMetaDef == null)
			return null;
		Object result = execute(targetMetaDef, methodMetaArgs, acw);
		Debug.logVerbose("+++++++++++++++execute service='" + name + "' method='" + methodMetaArgs.getMethodName() + "' successfully!", module);
		Debug.logVerbose("++++++++++++++++++++++++++++++<end:", module);
		return result;
	}
1297863
@Override
    public Session connectToServer(Object clazz, URI path) throws DeploymentException, IOException {

        if (clazz == null || path == null) {
            throw new IllegalArgumentException();
        }
        ClientConnector x = new ClientConnector();
        return x.connectAnnotatedClass(clazz, path, this);
    }
344771
protected void launch(String[] args, String mainClass, ClassLoader classLoader)
            throws Exception {
        Runnable runner = createMainMethodRunner(mainClass, args, classLoader);
        Thread.currentThread().setContextClassLoader(classLoader);
        runner.run();
    }
303036
public static void main(String[] args) {
    System.exit(getConf(
        ClientContext.create(new InstancedConfiguration(ConfigurationUtils.defaults())), args));
  }
1070296
public static void main(String[] args) throws InterruptedException {

        try (OpenShiftClient client = new DefaultOpenShiftClient()) {

          SecurityContextConstraints scc = new SecurityContextConstraintsBuilder()
            .withNewMetadata().withName("scc").endMetadata()
            .withAllowPrivilegedContainer(true)
            .withNewRunAsUser()
            .withType("RunAsAny")
            .endRunAsUser()
            .withNewSeLinuxContext()
            .withType("RunAsAny")
            .endSeLinuxContext()
            .withNewFsGroup()
            .withType("RunAsAny")
            .endFsGroup()
            .withNewSupplementalGroups()
            .withType("RunAsAny")
            .endSupplementalGroups()
            .addToUsers("admin")
            .addToGroups("admin-group")
            .build();

          log("Created SecurityContextConstraints", client.securityContextConstraints().create(scc));

          client.close();

        } catch (KubernetesClientException e) {
          logger.error(e.getMessage(), e);
        }
    }
716407
public static final void main(String [] args) throws Exception {
        ManagerApiMicroService microService = new ManagerApiMicroService();
        microService.start();
        microService.join();
    }
830157
def make_service(self, my_args=None):
        
        LOGGER.debug("natsd.Driver.make_service")
        if my_args is None:
            raise exceptions.ArianeConfError('service factory arguments')
        if not self.configuration_OK or self.connection_args is None:
            raise exceptions.ArianeConfError('NATS connection arguments')
        service = Service.start(my_args, self.connection_args).proxy()
        self.services_registry.append(service)
        return service
761213
public static void main(final String[] args) throws Exception {
    // Redirect all std out and err messages into log4j
    StdOutErrRedirect.redirectOutAndErrToLog();

    logger.info("Starting Jetty Azkaban Executor...");

    if (System.getSecurityManager() == null) {
      Policy.setPolicy(new Policy() {
        @Override
        public boolean implies(final ProtectionDomain domain, final Permission permission) {
          return true; // allow all
        }
      });
      System.setSecurityManager(new SecurityManager());
    }

    final Props props = AzkabanServer.loadProps(args);

    if (props == null) {
      logger.error("Azkaban Properties not loaded.");
      logger.error("Exiting Azkaban Executor Server...");
      return;
    }

    /* Initialize Guice Injector */
    final Injector injector = Guice.createInjector(
        new AzkabanCommonModule(props),
        new AzkabanExecServerModule()
    );
    SERVICE_PROVIDER.setInjector(injector);

    launch(injector.getInstance(AzkabanExecutorServer.class));
  }
267071
public static void runCLIApplication(Class<?> cls, String[] args) {
    SerializedParameterization params = new SerializedParameterization(args);
    Flag helpF = new Flag(Parameterizer.HELP_ID);
    params.grab(helpF);
    Flag helpLongF = new Flag(Parameterizer.HELP_LONG_ID);
    params.grab(helpLongF);
    try {
      ClassParameter<Object> descriptionP = new ClassParameter<>(Parameterizer.DESCRIPTION_ID, Object.class, true);
      params.grab(descriptionP);
      if(descriptionP.isDefined()) {
        params.clearErrors();
        printDescription(descriptionP.getValue());
        System.exit(1);
      }
      // Parse debug parameter
      StringParameter debugP = new StringParameter(Parameterizer.DEBUG_ID).setOptional(true);
      params.grab(debugP);
      if(debugP.isDefined()) {
        Parameterizer.parseDebugParameter(debugP);
      }
      // Fail silently on errors.
      if(params.getErrors().size() > 0) {
        params.logAndClearReportedErrors();
        System.exit(1);
      }
    }
    catch(Exception e) {
      printErrorMessage(e);
      System.exit(1);
    }
    try {
      TrackParameters config = new TrackParameters(params);
      Flag verboseF = new Flag(Parameterizer.VERBOSE_ID);
      if(config.grab(verboseF) && verboseF.isTrue()) {
        // Extra verbosity by repeating the flag:
        Flag verbose2F = new Flag(Parameterizer.VERBOSE_ID);
        LoggingConfiguration.setVerbose((config.grab(verbose2F) && verbose2F.isTrue()) ? Level.VERYVERBOSE : Level.VERBOSE);
      }
      AbstractApplication task = ClassGenericsUtil.tryInstantiate(AbstractApplication.class, cls, config);

      if((helpF.isDefined() && helpF.getValue()) || (helpLongF.isDefined() && helpLongF.getValue())) {
        LoggingConfiguration.setVerbose(Level.VERBOSE);
        LOG.verbose(usage(config.getAllParameters()));
        System.exit(1);
      }
      if(params.getErrors().size() > 0) {
        LoggingConfiguration.setVerbose(Level.VERBOSE);
        LOG.verbose("ERROR: The following configuration errors prevented execution:");
        for(ParameterException e : params.getErrors()) {
          LOG.verbose(e.getMessage() + "\n");
        }
        params.logUnusedParameters();
        LOG.verbose("Stopping execution because of configuration errors above.");
        System.exit(1);
      }
      params.logUnusedParameters();
      task.run();
    }
    catch(Exception e) {
      printErrorMessage(e);
    }
  }
28495
public static void main(final String[] args) {
		// init of the connection to the plugin
		int viewPort = 0;
		final List<String> classList = new ArrayList<String>();
		for (int i = 0; i < args.length; i++) {
			if (args[i].equals("-Port")) {
				if (args[i + 1] != null) {
					viewPort = Integer.parseInt(args[i + 1]);
				}
				break;
			} else {
				classList.add(args[i]);
			}
		}
		try {

			final IUpdater updater = new SocketViewProgressUpdater(null,
					viewPort);

			final SocketAdapter adapter = new SocketAdapter(updater,
					classList.toArray(new String[classList.size()]));

			adapter.registerClasses(classList.toArray(new String[classList
					.size()]));
			adapter.runBenchmark();
		} catch (final SocketViewException | ClassNotFoundException
				| InstantiationException | IllegalAccessException e) {
			throw new IllegalStateException(e);
		}
	}
682581
public static void main(String[] args) throws InterruptedException {
    Microservices ms1 =
        Microservices.builder()
            .discovery(ScalecubeServiceDiscovery::new)
            .transport(ServiceTransports::rsocketServiceTransport)
            .defaultErrorMapper(new ServiceAProviderErrorMapper()) // default mapper for whole node
            .services(
                ServiceInfo.fromServiceInstance(new ServiceAImpl())
                    .errorMapper(new ServiceAProviderErrorMapper()) // mapper per service instance
                    .build())
            .startAwait();

    System.err.println("ms1 started: " + ms1.serviceAddress());

    Microservices ms2 =
        Microservices.builder()
            .discovery(serviceEndpoint -> serviceDiscovery(serviceEndpoint, ms1))
            .transport(ServiceTransports::rsocketServiceTransport)
            .services(
                call -> {
                  ServiceA serviceA =
                      call.errorMapper(
                              new ServiceAClientErrorMapper()) // service client error mapper
                          .api(ServiceA.class);

                  ServiceB serviceB = new ServiceBImpl(serviceA);

                  return Collections.singleton(ServiceInfo.fromServiceInstance(serviceB).build());
                })
            .startAwait();

    System.err.println("ms2 started: " + ms2.serviceAddress());

    ms2.call()
        .api(ServiceB.class)
        .doAnotherStuff(0)
        .subscribe(
            System.out::println,
            th ->
                System.err.println(
                    "No service client mapper is defined for ServiceB, "
                        + "so default scalecube mapper is used! -> "
                        + th),
            () -> System.out.println("Completed!"));

    Thread.currentThread().join();
  }
469418
public static void main(final String... args) {

        // Configure command line options
        final Options options = new Options();
        options.addOption("c", "config", true, "use service configuration file / classpath "
                + "resource (default '" + DEFAULT_CONFIG + "')");
        options.addOption("v", "version", false,
                "display version and copyright information, then exit");
        options.addOption("h", "help", false, "display usage information, then exit");

        // Initialize exit status
        int status = EX_OK;

        try {
            // Parse command line and handle different commands
            final CommandLine cmd = new GnuParser().parse(options, args);
            if (cmd.hasOption("v")) {
                // Show version and copyright (http://www.gnu.org/prep/standards/standards.html)
                System.out.println(String.format(
                        "%s (FBK KnowledgeStore) %s\njava %s bit (%s) %s\n%s", PROGRAM_EXECUTABLE,
                        PROGRAM_VERSION, System.getProperty("sun.arch.data.model"),
                        System.getProperty("java.vendor"), System.getProperty("java.version"),
                        PROGRAM_DISCLAIMER));

            } else if (cmd.hasOption("h")) {
                // Show usage (done later) and terminate
                status = EX_USAGE;

            } else {
                // Run the service. Retrieve the configuration
                final String configLocation = cmd.getOptionValue('c', DEFAULT_CONFIG);

                // Differentiate between normal run, commons-daemon start, commons-daemon stop
                if (cmd.getArgList().contains("__start")) {
                    start(configLocation); // commons-daemon start
                } else if (cmd.getArgList().contains("__stop")) {
                    stop(); // commons-deamon stop
                } else {
                    run(configLocation); // normal execution
                }
            }

        } catch (final ParseException ex) {
            // Display error message and then usage on syntax error
            System.err.println("SYNTAX ERROR: " + ex.getMessage());
            status = EX_USAGE;

        } catch (final ServiceConfigurationError ex) {
            // Display error message and stack trace and terminate on configuration error
            System.err.println("INVALID CONFIGURATION: " + ex.getMessage());
            Throwables.getRootCause(ex).printStackTrace();
            status = EX_CONFIG;

        } catch (final Throwable ex) {
            // Display error message and stack trace on generic error
            System.err.print("EXECUTION FAILED: ");
            ex.printStackTrace();
            status = ex instanceof IOException ? EX_IOERR : EX_UNAVAILABLE;
        }

        // Display usage information if necessary
        if (status == EX_USAGE) {
            final PrintWriter out = new PrintWriter(System.out);
            final HelpFormatter formatter = new HelpFormatter();
            formatter.printUsage(out, WIDTH, PROGRAM_EXECUTABLE, options);
            if (PROGRAM_DESCRIPTION != null) {
                formatter.printWrapped(out, WIDTH, "\n" + PROGRAM_DESCRIPTION.trim());
            }
            out.println("\nOptions");
            formatter.printOptions(out, WIDTH, options, 2, 2);
            out.flush();
        }

        // Display exit status for convenience
        if (status != EX_OK) {
            System.err.println("[exit status: " + status + "]");
        } else {
            System.out.println("[exit status: " + status + "]");
        }

        // Flush STDIN and STDOUT before exiting (we noted truncated outputs otherwise)
        System.out.flush();
        System.err.flush();

        // Force exiting (in case there are threads still running)
        System.exit(status);
    }