Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OpenFunc ¶
type OpenFunc func() Resource
Must return a Resource of nil. When nil is returned the pool remains unchanged.
type Pool ¶
type Pool struct { Min int // minimum resources to keep Max int // maximum resources to open Concurrency int // number of types a resource can be acquired (concurrently) MaxIdle time.Duration // Time in idle state (no acquire resources) before closing excess resources (keeps at most Min resources) Open OpenFunc // Function for openeing a resource // contains filtered or unexported fields }
func (*Pool) Acquire ¶
Acquire a resource. This function blocks until a resource is available. When Acquire() is called after the pool is stopped it will return nil. Acquired resources MUST ALWAYS be released with Release().
func (*Pool) Stop ¶
func (p *Pool) Stop()
Stop the pool. This functions does't block (Use Wait() to wait for the pool to finish).
func (*Pool) StopAndWait ¶
func (p *Pool) StopAndWait()
Stop the pool. This function blocks until all resources have been returned.
Click to show internal directories.
Click to hide internal directories.