// New creates and returns a new context pool.
18755
func New(newFunc func() Context) *Pool {
	c := &Pool{pool: &sync.Pool{}, newFunc: newFunc}
	c.pool.New = func() interface{} { return c.newFunc() }
	return c
}
698462
func NewPool(opts Options) Pool {
	p := &poolOfContexts{
		ctxPool: pool.NewObjectPool(opts.ContextPoolOptions()),
		finalizersPool: newFinalizeablesArrayPool(finalizeablesArrayPoolOpts{
			Capacity:    opts.InitPooledFinalizerCapacity(),
			MaxCapacity: opts.MaxPooledFinalizerCapacity(),
			Options:     opts.FinalizerPoolOptions(),
		}),
	}

	p.finalizersPool.Init()
	p.ctxPool.Init(func() interface{} {
		return newPooledContext(p)
	})

	return p
}
411294
func New() *Application {
	app := new(Application)
	app.router = newRouter()
	app.staticRouter = make(map[string][]string)
	app.View = NewView()
	app.Config = NewConfig()
	app.errorHandler = make(map[int]ErrorHandlerFunc)
	app.middlewareChain = NewChain()
	app.DefaultErrorHandler = defaultErrorHandler
	app.pool.New = func() interface{} {
		return new(Context)
	}
	app.handlerChain = app.middlewareChain.Final(app.handler)
	return app
}
1185365
func New(settings SettingsManager, registry storage.ProviderRegistry) PoolManager {
	return &poolManager{settings, registry}
}
746773
func New(concurrency int) *Pool {
	wg := sync.WaitGroup{}
	p := Pool{
		errors:    multierror.ConcurrentAccumulator{},
		semaphore: make(chan bool, concurrency),
		wg:        &wg,
	}
	return &p
}
1142137
func New(processor func(Job), jobBufsize int, maxIdle, maxActive uint64) *Pool {
	p := &Pool{
		processor: processor,
		jobs:      make(chan Job, jobBufsize),
		maxIdle:   maxIdle,
		maxActive: maxActive,
	}
	return p
}
115281
func New(ic *plugin.InitContext) (interface{}, error) {
	ic.Meta.Platforms = []ocispec.Platform{platforms.DefaultSpec()}

	if err := os.MkdirAll(ic.Root, 0711); err != nil {
		return nil, err
	}
	if err := os.MkdirAll(ic.State, 0711); err != nil {
		return nil, err
	}
	m, err := ic.Get(plugin.MetadataPlugin)
	if err != nil {
		return nil, err
	}
	cfg := ic.Config.(*Config)
	r := &Runtime{
		root:    ic.Root,
		state:   ic.State,
		tasks:   runtime.NewTaskList(),
		db:      m.(*metadata.DB),
		address: ic.Address,
		events:  ic.Events,
		config:  cfg,
	}
	tasks, err := r.restoreTasks(ic.Context)
	if err != nil {
		return nil, err
	}
	for _, t := range tasks {
		if err := r.tasks.AddWithNamespace(t.namespace, t); err != nil {
			return nil, err
		}
	}
	return r, nil
}
160894
func New(deps *deps.Deps) *Namespace {
	cache := namedmemcache.New()
	deps.BuildStartListeners.Add(
		func() {
			cache.Clear()
		})

	return &Namespace{
		cache: cache,
		deps:  deps,
	}
}
597548
func NewPool(parentCtx context.Context) *Pool {
	baseCtx, baseCancel := context.WithCancel(parentCtx)
	ctx, cancel := context.WithCancel(baseCtx)
	return &Pool{
		baseCtx:    baseCtx,
		baseCancel: baseCancel,
		ctx:        ctx,
		cancel:     cancel,
	}
}
1333745
func New(d *dic.Dic, u *dic.UserDic) *Lattice {
	la := latticePool.Get().(*Lattice)
	la.dic = d
	la.udic = u
	return la
}
533761
func New(input string, capacity int) <-chan Token {
	if capacity < 0 {
		capacity = 0
	}
	_, c := lex(input, capacity)
	return c
}
485611
func New(buckets []Bucket) *Continuum {
	var ret Continuum
	ret.Reset(buckets)
	return &ret
}
496663
func New(path string) (*Cache, error) {
	cache := &Cache{}

	var err error
	cache.db, err = leveldb.OpenFile(path, nil)

	if err != nil {
		return nil, err
	}
	return cache, nil
}
672828
func New(config Config) session.Store {
	return &redisStore{
		pool:   config.Pool,
		prefix: config.Prefix,
	}
}
137708
func New() (cs *Caddyshack) {
	// Fixme May need to extend later
	cs = &Caddyshack{
		Config:  NewConfig(),
		Caddies: make(map[string]*Caddies),
	}
	return cs
}
1004383
func New() *Application {
	config := DefaultConfiguration()

	app := &Application{
		config:     &config,
		logger:     golog.Default,
		APIBuilder: router.NewAPIBuilder(),
		Router:     router.NewRouter(),
	}

	app.ContextPool = context.New(func() context.Context {
		return context.NewContext(app)
	})

	return app
}
397338
func New(config Config) *Cache {
	return &Cache{
		m:      make(map[Key]*list.Element, config.MaxItems),
		l:      list.New(),
		config: config,
	}
}