func NewAnalyzerPool(total uint32, generator GenerateAnalyzer) MKAnalyzerPool { etype := reflect.TypeOf(generator()) generatorEntity := func() middleware.MKEntity { return generator() } pool, err := middleware.NewPool(total, etype, generatorEntity) if err != nil { return nil, err } downloaderPool := &mk_analyzerPool{pool: pool, etype: etype} return downloaderPool, nil }
// 创建网页下载器池 func NewPageDownloaderPool(total uint32, generator GeneratePageDownloader) (MKPageDownloaderPool, error) { etype := reflect.TypeOf(generator) generateEntity := func() middleware.MKEntity { return generator() } pool, err := middleware.NewPool(total, etype, generateEntity) if err != nil { return nil, err } downloaderPool := &mk_PageDownloaderPool{ pool: pool, etype: etype, } return downloaderPool, nil }