Package titan

Class Main

java.lang.Object
titan.Main

public class Main extends Object
The main entry point for the Titan distributed system application. This class allows the application to be started in one of two primary modes:
  • SCHEDULER: Runs the Titan Scheduler component, responsible for coordinating tasks and resources.
  • WORKER: Runs a Titan Worker component, which executes tasks assigned by the Scheduler.
The operational mode and associated parameters are determined by command-line arguments.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    main(String[] args)
    The main method, serving as the application's entry point.
    private static void
    Prints the correct command-line usage instructions for running the Titan application.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Main

      public Main()
  • Method Details

    • main

      public static void main(String[] args)
      The main method, serving as the application's entry point. It parses command-line arguments to determine whether to start the Titan application as a Scheduler or a Worker, and initializes the respective components with the provided parameters. If no arguments are provided or an unknown mode is specified, it prints usage instructions.
      Parameters:
      args - Command-line arguments specifying the operational mode and configuration parameters. Expected formats:
      • SCHEDULER [port]: Starts the Scheduler. `port` is optional, defaults to 9090.
      • WORKER [myPort] [schedHost] [schedPort] [capability] [isPermanent]: Starts a Worker. `myPort` is optional, defaults to 8081. `schedHost` is optional, defaults to "localhost". `schedPort` is optional, defaults to 9090. `capability` is optional, defaults to "GENERAL". `isPermanent` is optional, defaults to false, indicating if the worker should re-register on disconnect.
      Catches and prints any critical exceptions that occur during the startup and initialization of the Scheduler or Worker components.
    • printUsage

      private static void printUsage()
      Prints the correct command-line usage instructions for running the Titan application. This method is called when no arguments are provided or an invalid mode is specified, guiding the user on how to start the application in SCHEDULER or WORKER mode with their respective parameters.