MCPcopy Index your code
hub / github.com/apache/tomcat / main

Method main

java/org/apache/catalina/startup/Bootstrap.java:441–511  ·  view source on GitHub ↗

Main method and entry point when starting Tomcat via the provided scripts. @param args Command line arguments to be processed

(String[] args)

Source from the content-addressed store, hash-verified

439 * @param args Command line arguments to be processed
440 */
441 public static void main(String[] args) {
442
443 synchronized (daemonLock) {
444 if (daemon == null) {
445 // Don't set daemon until init() has completed
446 Bootstrap bootstrap = new Bootstrap();
447 try {
448 bootstrap.init();
449 } catch (Throwable t) {
450 handleThrowable(t);
451 log.error("Init exception", t);
452 return;
453 }
454 daemon = bootstrap;
455 } else {
456 // When running as a service the call to stop will be on a new
457 // thread so make sure the correct class loader is used to
458 // prevent a range of class not found exceptions.
459 Thread.currentThread().setContextClassLoader(daemon.catalinaLoader);
460 }
461 }
462
463 try {
464 String command = "start";
465 if (args.length > 0) {
466 command = args[args.length - 1];
467 }
468
469 switch (command) {
470 case "startd":
471 args[args.length - 1] = "start";
472 daemon.load(args);
473 daemon.start();
474 break;
475 case "stopd":
476 args[args.length - 1] = "stop";
477 daemon.stop();
478 break;
479 case "start":
480 daemon.setAwait(true);
481 daemon.load(args);
482 daemon.start();
483 if (null == daemon.getServer()) {
484 System.exit(1);
485 }
486 break;
487 case "stop":
488 daemon.stopServer(args);
489 break;
490 case "configtest":
491 daemon.load(args);
492 if (null == daemon.getServer()) {
493 System.exit(1);
494 }
495 System.exit(0);
496 break;
497 default:
498 log.warn("Bootstrap: command \"" + command + "\" does not exist.");

Callers

nothing calls this directly

Calls 11

initMethod · 0.95
handleThrowableMethod · 0.95
errorMethod · 0.65
loadMethod · 0.65
startMethod · 0.65
stopMethod · 0.65
getServerMethod · 0.65
warnMethod · 0.65
setAwaitMethod · 0.45
stopServerMethod · 0.45
getCauseMethod · 0.45

Tested by

no test coverage detected