Documentation ¶
Index ¶
- Constants
- Variables
- type IdleClient
- type MapPool
- type ThriftClientClose
- type ThriftDial
- type ThriftPool
- func (p *ThriftPool) CheckTimeout()
- func (p *ThriftPool) ClearConn()
- func (p *ThriftPool) CloseErrConn(client *IdleClient)
- func (p *ThriftPool) Get() (*IdleClient, error)
- func (p *ThriftPool) GetConnCount() uint32
- func (p *ThriftPool) GetIdleCount() uint32
- func (p *ThriftPool) Put(client *IdleClient) error
- func (p *ThriftPool) Recover()
- func (p *ThriftPool) Release()
Constants ¶
View Source
const (
CHECKINTERVAL = 60 //清除超时连接间隔
)
Variables ¶
View Source
var ( ErrOverMax = errors.New("连接超过设置的最大连接数") ErrInvalidConn = errors.New("Client回收时变成nil") ErrPoolClosed = errors.New("连接池已经被关闭") ErrSocketDisconnect = errors.New("客户端socket连接已断开") )
error
Functions ¶
This section is empty.
Types ¶
type IdleClient ¶
func (*IdleClient) Check ¶
func (c *IdleClient) Check() bool
func (*IdleClient) LocalAddr ¶
func (c *IdleClient) LocalAddr() net.Addr
func (*IdleClient) RemoteAddr ¶
func (c *IdleClient) RemoteAddr() net.Addr
func (*IdleClient) SetConnTimeout ¶
func (c *IdleClient) SetConnTimeout(connTimeout uint32)
type MapPool ¶
type MapPool struct { Dial ThriftDial Close ThriftClientClose // contains filtered or unexported fields }
func NewMapPool ¶
func NewMapPool(maxConn, connTimeout, idleTimeout uint32, dial ThriftDial, closeFunc ThriftClientClose) *MapPool
func (*MapPool) Get ¶
func (mp *MapPool) Get(ip, port string) *ThriftPool
func (*MapPool) ReleaseAll ¶
func (mp *MapPool) ReleaseAll()
type ThriftClientClose ¶
type ThriftClientClose func(c *IdleClient) error
type ThriftDial ¶
type ThriftDial func(ip, port string, connTimeout time.Duration) (*IdleClient, error)
type ThriftPool ¶
type ThriftPool struct { Dial ThriftDial Close ThriftClientClose // contains filtered or unexported fields }
func NewThriftPool ¶
func NewThriftPool(ip, port string, maxConn, connTimeout, idleTimeout uint32, dial ThriftDial, closeFunc ThriftClientClose) *ThriftPool
func (*ThriftPool) CheckTimeout ¶
func (p *ThriftPool) CheckTimeout()
func (*ThriftPool) ClearConn ¶
func (p *ThriftPool) ClearConn()
func (*ThriftPool) CloseErrConn ¶
func (p *ThriftPool) CloseErrConn(client *IdleClient)
func (*ThriftPool) Get ¶
func (p *ThriftPool) Get() (*IdleClient, error)
func (*ThriftPool) GetConnCount ¶
func (p *ThriftPool) GetConnCount() uint32
func (*ThriftPool) GetIdleCount ¶
func (p *ThriftPool) GetIdleCount() uint32
func (*ThriftPool) Put ¶
func (p *ThriftPool) Put(client *IdleClient) error
func (*ThriftPool) Recover ¶
func (p *ThriftPool) Recover()
func (*ThriftPool) Release ¶
func (p *ThriftPool) Release()
Click to show internal directories.
Click to hide internal directories.