// NewPooledObjectFactory return a DefaultPooledObjectFactory, init with gaven func.
NewPooledObjectFactory return a DefaultPooledObjectFactory, init with gaven func.
// NewPooledObjectFactory return a DefaultPooledObjectFactory init with gaven func .
func NewPooledObjectFactory(
	create func() (interface{}, error),
	destroy func(object *PooledObject) error,
	validate func(object *PooledObject) bool,
	activate func(object *PooledObject) error,
	passivate func(object *PooledObject) error) PooledObjectFactory {
	if create == nil {
		panic(errors.New("make function can not be nil"))
	}
	return &DefaultPooledObjectFactory{
		make: func() (*PooledObject, error) {
			o, err := create()
			if err != nil {
				return nil, err
			}
			return NewPooledObject(o), nil
		},
		destroy:   destroy,
		validate:  validate,
		activate:  activate,
		passivate: passivate}
}
func NewPooledObjectFactory ( create func ( ) ( interface { } , error ) , destroy func ( object * PooledObject ) error , validate func ( object * PooledObject ) bool , activate func ( object * PooledObject ) error , passivate func ( object * PooledObject ) error ) PooledObjectFactory { if create == nil { panic ( errors . New ( " " ) ) } return & DefaultPooledObjectFactory { make : func ( ) ( * PooledObject , error ) { o , err := create ( ) if err != nil { return nil , err } return NewPooledObject ( o ) , nil } , destroy : destroy , validate : validate , activate : activate , passivate : passivate } }
NewPooledObjectFactory return a DefaultPooledObjectFactory, init with gaven func.
NewPooledObjectFactory return a DefaultPooledObjectFactory init with gaven func .