In my web application, I have developed a 'Users Online' module (implemented as a user control) using Atlas. This user control calls a web service (to let it know that this user is online) as soon and as long as the user has my web application open in his browser. This same user control has code to check if a user is online. I can throw this user control in places such as a data grid which shows lists of users. As soon as a user comes online, a 'User online' lighbulb lights up next to that user's name in the datagrid row. The problem is that the User Online icon lights up and goes off erratically.
At the heart of this operation is my web service which has 2 methods which I have copied below. The problem I am running into is that I think I have reentrancy problems in my web service methods. There is a large number of web service calls being made to this web service. How can I avoid multiple threads from entering my web service method simultaneously? <WebMethod()> _ Public Sub MarkEntityAsOnline(ByVal EntityClass As String, ByVal EntityId As String) Try Dim ctx As HttpContext = HttpContext.Current If ctx IsNot Nothing Then ctx.Cache.Insert(EntityClass & EntityId, "Y", Nothing, DateTime.Now.AddMinutes(1), Cache.NoSlidingExpiration) End If Catch ex As System.Exception Finally End Try End Sub <WebMethod()> _ Public Function IsEntityOnline(ByVal EntityClass As String, ByVal EntityId As String) As String Dim retVal As Boolean = False Try Dim ctx As HttpContext = HttpContext.Current If ctx IsNot Nothing Then Dim cache_item As Object = ctx.Cache.Item(EntityClass & EntityId) If cache_item IsNot Nothing Then retVal = True End If End If Catch ex As System.Exception Finally End Try Return retVal.ToString().ToUpper() End Function =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
