我有一些不同的方法,每种方法都从不同的站点导入产品。如果我按顺序执行这些操作,整个过程会花费大量时间,尤其是当一种方法在响应速度较慢的站点上运行时。
我宁愿同时运行它们。
到目前为止,这是我使用 1 个示例方法所拥有的:
Public Class feedParameters
Private _productIdPrefix As String
Private _publishersite As String
Private _feedURL As String
Public Property productIdPrefix() As String
Get
Return _productIdPrefix
End Get
Set(value As String)
_productIdPrefix = value
End Set
End Property
Public Property publishersite() As String
Get
Return _publishersite
End Get
Set(value As String)
_publishersite = value
End Set
End Property
Public Property feedURL() As String
Get
Return _feedURL
End Get
Set(value As String)
_feedURL = value
End Set
End Property
End Class
Dim fpm As New feedParameters
fpm.publishersite = "mypublisher.nl"
fpm.feedURL = "http://www.domain.com/test.xml"
fpm.productIdPrefix = "10"
Protected Sub ImportProductsPublisherA(ByVal productIdPrefix As String, ByVal publishersite As String, ByVal feedURL As String)
End Sub
我试过这个:
System.Threading.ThreadPool.QueueUserWorkItem(New System.Threading.WaitCallback(AddressOf ImportProductsPublisherA()), fpm)
然后我得到 3 个错误,我没有为 3 个参数指定参数:productIdPrefix、publishersite 和 feedURL
我也试过:
System.Threading.ThreadPool.QueueUserWorkItem(New System.Threading.WaitCallback(AddressOf ImportProductsPublisherA), fpm)
我收到此错误:方法 'Protected Sub ImportProductsPublisherA(productIdPrefix As String, publishersite As String, feedURL As String)' 没有与委托 'Delegate Sub WaitCallback(state As Object)' 兼容的签名。
任何帮助是极大的赞赏!