diff options
author | Wolfy-J <[email protected]> | 2018-06-07 15:37:21 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-07 15:37:21 +0300 |
commit | ef26e854480562de15edffe3b38f86bc22bedd76 (patch) | |
tree | 258d89fb103ae184a87dcb47de42a8f275582866 /server.go | |
parent | 33040a9b1bce85e174ee68f6ba8c73b1dbf43b56 (diff) |
server failure
Diffstat (limited to 'server.go')
-rw-r--r-- | server.go | 24 |
1 files changed, 10 insertions, 14 deletions
@@ -7,23 +7,20 @@ import ( ) const ( - // EventNewPool triggered when server creates new pool. - EventServerStart = iota + 128 + // EventPoolConstruct triggered when server creates new pool. + EventServerStart = iota + 200 - // EventNewPool triggered when server creates new pool. + // EventPoolConstruct triggered when server creates new pool. EventServerStop // EventServerFailure triggered when server is unable to replace dead pool. EventServerFailure - // EventReplaceFailure triggered when server can not replace pool while the re-configuration. - EventReplaceFailure + // EventPoolConstruct triggered when server creates new pool. + EventPoolConstruct - // EventNewPool triggered when server creates new pool. - EventNewPool - - // EventDestroyPool triggered when server destroys existed pool. - EventDestroyPool + // EventPoolDestruct triggered when server destroys existed pool. + EventPoolDestruct ) // Service manages pool creation and swapping. @@ -77,7 +74,6 @@ func (srv *Server) Reconfigure(cfg *ServerConfig) error { pool, err := NewPool(srv.cmd, srv.factory, cfg.Pool) if err != nil { - srv.throw(EventReplaceFailure, err) return err } @@ -86,11 +82,11 @@ func (srv *Server) Reconfigure(cfg *ServerConfig) error { srv.pool.Observe(srv.poolObserver) srv.mu.Unlock() - srv.throw(EventNewPool, pool) + srv.throw(EventPoolConstruct, pool) if previous != nil { go func(previous Pool) { - srv.throw(EventDestroyPool, previous) + srv.throw(EventPoolDestruct, previous) previous.Destroy() }(previous) } @@ -132,7 +128,7 @@ func (srv *Server) Stop() error { return nil } - srv.throw(EventDestroyPool, srv.pool) + srv.throw(EventPoolDestruct, srv.pool) srv.pool.Destroy() srv.factory.Close() |