event stop add
This commit is contained in:
parent
47a6698007
commit
b55a51bf07
|
@ -10,6 +10,7 @@ import (
|
|||
"log"
|
||||
"reflect"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -40,18 +41,27 @@ func GetInstance() *EventSender {
|
|||
|
||||
func init() {
|
||||
ch := make(chan interface{}, 0)
|
||||
observer.Add(messages.CONFIGMANAGER_LOADED, ch)
|
||||
handleInit(ch)
|
||||
ch1 := make(chan interface{}, 0)
|
||||
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()
|
||||
go func() {
|
||||
data := <-ch
|
||||
log.Println("handleInit", data)
|
||||
//ds.gconf = data.(cm.ConfigManager).GetGlobalConfig()
|
||||
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