Esempio n. 1
0
func (m *PushServiceManager) RegisterPushServiceType(pt PushServiceType) error {
	name := pt.Name()
	pair := new(serviceTypeObjPool)
	pair.pspPool = mempool.NewObjectMemoryPool(1024, newPushServiceProvider)
	pair.dpPool = mempool.NewObjectMemoryPool(1024, newDeliveryPoint)
	pair.pst = pt
	m.serviceTypes[name] = pair
	return nil
}
Esempio n. 2
0
func NewNotificationPool(n, l int) *NotificationPool {
	ret := new(NotificationPool)
	if n <= 0 {
		n = 16
	}
	if l <= 0 {
		l = 2
	}
	ret.maxNrPools = n
	ret.minMapLen = l
	ret.pools = make([]*mempool.ObjectMemoryPool, ret.maxNrPools)

	for i := 0; i < n; i++ {
		ret.pools[i] = mempool.NewObjectMemoryPool(1024, newEmptyNotif)
	}

	return ret
}