Ocean/Shutdown/Shutdown.go
Thorsten Sommer 7120a729bd Bug fixing
+ DB access is now right and uses copied sessions
+ DB session is now specifying the safe state and the mode
+ Fixed the issue with too early ICCC messages regarding to late cache
+ Add the MIME type for Dart
+ Fixed the issuse with wrong order of shutdown handlers
- TODO: Testing of these changes
2014-06-04 21:41:18 +02:00

30 lines
921 B
Go

package Shutdown
import "os"
import "github.com/SommerEngineering/Ocean/Log"
import LM "github.com/SommerEngineering/Ocean/Log/Meta"
type ShutdownHandler interface {
Shutdown()
}
func AddShutdownHandler(handler ShutdownHandler) {
shutdownHandlers.PushFront(handler)
}
func executeShutdown() {
sig := <-shutdownSignal
stopAllRequests = true
Log.LogFull(senderName, LM.CategorySYSTEM, LM.LevelWARN, LM.SeverityCritical, LM.ImpactCritical, LM.MessageNameSHUTDOWN, `The system was called to shutting down.`, sig.String(), `Call now all shutdown handlers.`)
for handler := shutdownHandlers.Front(); handler != nil; handler = handler.Next() {
h := handler.Value.(ShutdownHandler)
h.Shutdown()
}
Log.LogFull(senderName, LM.CategorySYSTEM, LM.LevelWARN, LM.SeverityCritical, LM.ImpactCritical, LM.MessageNameSHUTDOWN, `The system is shutting down now.`)
Log.Flush()
os.Exit(6)
}