コード例 #1
0
ファイル: client.go プロジェクト: sdmajor/skynet
func (c *Client) getServicePool(instance *service.Service) (sp *servicePool) {
	servicePoolMutex.Lock()
	defer servicePoolMutex.Unlock()

	key := getInstanceKey(instance)

	var ok bool
	if sp, ok = c.servicePools[key]; ok {
		return
	}

	sp = &servicePool{
		service: instance,
		pool:    pools.NewResourcePool(getConnectionFactory(instance), c.Config.ConnectionPoolSize, c.Config.ConnectionPoolSize),
	}
	return
}
コード例 #2
0
ファイル: client.go プロジェクト: yahame/skynet
func (c *Client) getServicePool(instance *skynet.ServiceInfo) (sp *servicePool) {
	servicePoolMutex.Lock()
	defer servicePoolMutex.Unlock()

	key := getInstanceKey(instance)

	var ok bool
	if sp, ok = c.servicePools[key]; ok {
		return
	}

	dbgf("making service pool, size = %d, %d\n", c.Config.IdleConnectionsToInstance, c.Config.MaxConnectionsToInstance)

	sp = &servicePool{
		service: instance,
		pool:    pools.NewResourcePool(getConnectionFactory(instance), c.Config.IdleConnectionsToInstance, c.Config.MaxConnectionsToInstance),
	}
	return
}