Skip to content

Commit

Permalink
comment: fix comment and error message typo
Browse files Browse the repository at this point in the history
  • Loading branch information
jolestar committed Mar 17, 2017
1 parent 2a8d65f commit 4de6736
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (pool *ObjectPool) addIdleObject(p *PooledObject) {
}
}

// BorrowObject obtains an instance from pool pool.
// BorrowObject obtains an instance from pool.
// Instances returned from pool method will have been either newly created
// with PooledObjectFactory.MakeObject or will be a previously
// idle object and have been activated with
Expand All @@ -120,14 +120,14 @@ func (pool *ObjectPool) BorrowObject() (interface{}, error) {
return pool.borrowObject(pool.Config.MaxWaitMillis)
}

// GetNumIdle return the number of instances currently idle in pool pool. This may be
// GetNumIdle return the number of instances currently idle in pool. This may be
// considered an approximation of the number of objects that can be
// BorrowObject borrowed without creating any new instances.
func (pool *ObjectPool) GetNumIdle() int {
return pool.idleObjects.Size()
}

// GetNumActive return the number of instances currently borrowed from pool pool.
// GetNumActive return the number of instances currently borrowed from pool.
func (pool *ObjectPool) GetNumActive() int {
return pool.allObjects.Size() - pool.idleObjects.Size()
}
Expand Down Expand Up @@ -371,7 +371,7 @@ func (pool *ObjectPool) ReturnObject(object interface{}) error {
if !ok {
if !pool.isAbandonedConfig() {
return NewIllegalStateErr(
"Returned object not currently part of pool pool")
"Returned object not currently part of pool")
}
return nil // Object was abandoned and removed
}
Expand All @@ -381,7 +381,7 @@ func (pool *ObjectPool) ReturnObject(object interface{}) error {
if state != StateAllocated {
p.lock.Unlock()
return NewIllegalStateErr(
"Object has already been returned to pool pool or is invalid")
"Object has already been returned to pool or is invalid")
}
//use unlock method markReturning() not MarkReturning
// because go lock is not recursive
Expand Down Expand Up @@ -410,7 +410,7 @@ func (pool *ObjectPool) ReturnObject(object interface{}) error {
}

if !p.Deallocate() {
return NewIllegalStateErr("Object has already been returned to pool pool or is invalid")
return NewIllegalStateErr("Object has already been returned to pool or is invalid")
}

maxIdleSave := pool.Config.MaxIdle
Expand Down Expand Up @@ -457,7 +457,7 @@ func (pool *ObjectPool) InvalidateObject(object interface{}) error {
return nil
}
return NewIllegalStateErr(
"Invalidated object not currently part of pool pool")
"Invalidated object not currently part of pool")
}
p.lock.Lock()
if p.state != StateInvalid {
Expand All @@ -468,7 +468,7 @@ func (pool *ObjectPool) InvalidateObject(object interface{}) error {
return nil
}

// Close pool pool, and free any resources associated with it.
// Close pool, and free any resources associated with it.
func (pool *ObjectPool) Close() {
if pool.IsClosed() {
return
Expand Down

0 comments on commit 4de6736

Please sign in to comment.