Ejemplo n.º 1
0
func NewRegistry(c *config.Config, messageBusClient mbus.CFMessageBus) *Registry {
	r := &Registry{
		messageBus: messageBusClient,
	}

	r.Logger = steno.NewLogger("router.registry")

	r.ActiveApps = stats.NewActiveApps()
	r.TopApps = stats.NewTopApps()

	r.byUri = make(map[Uri][]*Backend)
	r.byBackendId = make(map[BackendId]*Backend)

	r.staleTracker = util.NewListMap()

	r.pruneStaleDropletsInterval = c.PruneStaleDropletsInterval
	r.dropletStaleThreshold = c.DropletStaleThreshold

	return r
}
Ejemplo n.º 2
0
func NewRegistry(c *config.Config) *Registry {
	r := &Registry{}

	r.Logger = steno.NewLogger("router.registry")

	r.ActiveApps = stats.NewActiveApps()
	r.TopApps = stats.NewTopApps()

	r.byUri = make(map[Uri][]*Backend)
	r.byBackendId = make(map[BackendId]*Backend)

	r.staleTracker = util.NewListMap()

	r.pruneStaleDropletsInterval = c.PruneStaleDropletsInterval
	r.dropletStaleThreshold = c.DropletStaleThreshold

	go r.checkAndPrune()

	return r
}
Ejemplo n.º 3
0
func NewRegistry(c *config.Config) *Registry {
	r := &Registry{}

	r.Logger = steno.NewLogger("registry")

	r.ActiveApps = stats.NewActiveApps()
	r.TopApps = stats.NewTopApps()

	r.byUri = make(map[Uri]BackendIds)
	r.byBackendId = make(map[BackendId]*registerMessage)

	r.tracker = list.New()
	r.trackerIndexes = make(map[BackendId]*list.Element)

	r.pruneStaleDropletsInterval = c.PruneStaleDropletsInterval
	r.dropletStaleThreshold = c.DropletStaleThreshold

	go r.checkAndPrune()

	return r
}