SSRS Code Shared Variables and Simultaneous Report Execution

半城伤御伤魂 提交于 2019-12-04 12:07:51
Ben

Your code looks fine. For thread safety only the root (shared) hashtable Data needs to be synchronised. If you want to avoid using your InstanceID you could use Globals.ExecutionTime and User.UserID concatenated.

Basically I think you just want to change to initialize like this:

Private Shared Data As System.Collections.Hashtable 

If Data Is Nothing Then
   Set Data = Hashtable.Synchronized(New System.Collections.Hashtable())
End If

The contained hashtables should only be used by one thread at a time anyway, but if in doubt, you could synchronize them too.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!