event stop add
This commit is contained in:
parent
47a6698007
commit
b55a51bf07
|
@ -10,6 +10,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -40,18 +41,27 @@ func GetInstance() *EventSender {
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
ch := make(chan interface{}, 0)
|
ch := make(chan interface{}, 0)
|
||||||
observer.Add(messages.CONFIGMANAGER_LOADED, ch)
|
ch1 := make(chan interface{}, 0)
|
||||||
handleInit(ch)
|
observer.Add(messages.CFG_LOADED, ch)
|
||||||
|
observer.Add(messages.SCF_STOPPED,ch1)
|
||||||
|
handleInit(ch, ch1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleInit(ch chan interface{}) {
|
func handleInit(ch chan interface{}, ch1 chan interface{}) {
|
||||||
es := GetInstance()
|
es := GetInstance()
|
||||||
go func() {
|
go func() {
|
||||||
data := <-ch
|
data := <-ch
|
||||||
log.Println("handleInit", data)
|
log.Println("handleInit", data)
|
||||||
//ds.gconf = data.(cm.ConfigManager).GetGlobalConfig()
|
//ds.gconf = data.(cm.ConfigManager).GetGlobalConfig()
|
||||||
es.start()
|
es.start()
|
||||||
close(ch)
|
observer.Remove(messages.CFG_LOADED, ch)
|
||||||
|
}()
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
data := <- ch1
|
||||||
|
observer.Notify(messages.QUEUE_DATA, data)
|
||||||
|
time.Sleep(2*time.Second)
|
||||||
|
es.Stop()
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user