src/interface/main.go enhancement main 87/204387/1
authorjaehoon.hyun <jaehoon.hyun@samsung.com>
Tue, 23 Apr 2019 10:10:41 +0000 (19:10 +0900)
committerjaehoon.hyun <jaehoon.hyun@samsung.com>
Tue, 23 Apr 2019 10:10:41 +0000 (19:10 +0900)
scoringmgr thread working
Ready variable add

Change-Id: Ia46935e82c2b5be22ccf3f0fa1a0a7a34b76b482

src/interface/main.go

index b659268..848ce62 100755 (executable)
@@ -72,11 +72,10 @@ func OrchestrationInit() (errCode C.int) {
 
        orcheEngine.IScoringmgr = scoringmgr.Init()
        orcheEngine.IConfiguremgr = configuremgr.Init()
-       discoverymgr.InitDiscovery()
-       servicemgr.Init()
-       securemgr.Init(keyFilePath)
 
        orcheEngine.IScoringmgr.IRunningScore = scoringmgr.LoadScoringGeneralInterface
+       orcheEngine.IScoringmgr.IStartResourceService = scoringmgr.StartResourceService
+       orcheEngine.IScoringmgr.IStopResourceService = scoringmgr.StopResourceService
        orcheEngine.IScoringmgr.IGetScore = scoringmgr.GetScore
        orcheEngine.IScoringmgr.Ch = make(chan interface{}, 1024)
 
@@ -87,15 +86,35 @@ func OrchestrationInit() (errCode C.int) {
        orcheEngine.IDiscoverymgr.GetEndpointDevices = discoverymgr.GetDeviceListWithService
        orcheEngine.IServicemgr.ExecuteApp = servicemgr.ExecuteApp
 
+       //1.scoringmgr init
        orcheEngine.IScoringmgr.Listening()
+       orcheEngine.IScoringmgr.IStartResourceService()
+       
+       //2.configuremgr init
        go orcheEngine.IConfiguremgr.Watch("/etc/edge-orchestration")
 
+       //3.securemgr init
+       securemgr.Init(keyFilePath)
+       
+       //4.servicemgr init
+       servicemgr.Init()
+       
+       //5.discoverymgr init
+       discoverymgr.InitDiscovery()
+       discoverymgr.GetDeviceList()
+
+       //6.httpserver init
        router := restapi.NewRouter()
        go http.ListenAndServe(fmt.Sprintf(":%d", ConstWellknownPort), router)
 
-       discoverymgr.GetDeviceList()
-
+       
        errCode = 0
+       
+       log.Println(logPrefix, "orchestration init done")
+       
+       //NOTE : CMain work init thread and requestservice thread seperatly.
+       //NOTE : Need Ready variable.
+       orcheEngine.Ready = true
 
        return
 }