public ISchedulerClient getSchedulerClient ( ) throws SchedulerException { LOG . fine ( "Creating scheduler client" ) ; ISchedulerClient schedulerClient ; if ( Context . schedulerService ( config ) ) { // get the instance of the state manager SchedulerStateManagerAdaptor statemgr = Runtime . schedulerStateManagerAdaptor ( runtime ) ; Scheduler . SchedulerLocation schedulerLocation = statemgr . getSchedulerLocation ( Runtime . topologyName ( runtime ) ) ; if ( schedulerLocation == null ) { throw new SchedulerException ( "Failed to get scheduler location from state manager" ) ; } LOG . log ( Level . FINE , "Scheduler is listening on location: {0} " , schedulerLocation . toString ( ) ) ; schedulerClient = new HttpServiceSchedulerClient ( config , runtime , schedulerLocation . getHttpEndpoint ( ) ) ; } else { // create an instance of scheduler final IScheduler scheduler = LauncherUtils . getInstance ( ) . getSchedulerInstance ( config , runtime ) ; LOG . fine ( "Invoke scheduler as a library" ) ; schedulerClient = new LibrarySchedulerClient ( config , runtime , scheduler ) ; } return schedulerClient ; }
Implementation of getSchedulerClient - Used to create objects Currently it creates either HttpServiceSchedulerClient or LibrarySchedulerClient