Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > application scope objects

Reply
Thread Tools

application scope objects

 
 
spolsky
Guest
Posts: n/a
 
      10-04-2006
i use an application scope recordset object for holding the list of
online users. i am not sure that if i have to handle concurrency issues

like one user is looping through the recordset for getting the list of
online users while another one is getting online so adding a new
record. ado recordset has a free and apartment threading model(marked
ThreadingModel = Both in the registry) so i think it should handle the
concurrency issues and recordset access will not be conflicted.

otherwise, if it could not handle the concurrency i think
- i should put that application scoped recordset into application
collection and use application.lock/unlock methods.
- or serializing the recordset access by an application variable and

locking/unlocking the application for synchronization.
what do you think about these ones?


on the other hand, i know that there are different ways to hold and
provide the list of online users using application variables, database
etc. but i want to clarify the concept of application scope objects to
myself. thus, is there be any concurrency problems with this method? if

so what could
be it done? also what about the efficiency of it?


thanks


--- global.asa ---
<object runat="Server" scope="Application"
id="rstActiveUsers" progid="ADODB.Recordset">
</object>


<script language="VBScript" runat="Server">
Sub Application_OnStart
Const adInteger = 3
Const adVarChar = 200


rstActiveUsers.Fields.Append "id", adInteger
rstActiveUsers.Fields.Append "nick", adVarChar, 50


rstActiveUsers.Open
End Sub
Sub Session_OnEnd
Const adSearchForward = 1
Const adBookmarkFirst = 1
Const adAffectCurrent = 1


rstActiveUsers.Find "id = " & Session.SessionID, _
0, adSearchForward, adBookmarkFirst


If Not rstActiveUsers.EOF Then
rstActiveUsers.Delete adAffectCurrent
End If
End Sub
</script>


-- newuser.asp --
rstActiveUsers.AddNew
rstActiveUsers.Fields("id").Value = Session.SessionID
rstActiveUsers.Fields("nick").Value = RsUser("nick")
rstActiveUsers.Update


-- onlineusers.asp --
Dim fNick
Set fNick = rstActiveUsers.Fields("nick")


If Not rstActiveUsers.EOF Then rstActiveUsers.MoveFirst
While Not rstActiveUsers.EOF
Response.Write(fNick)


rstActiveUsers.MoveNext
If Not rstActiveUsers.EOF Then
Response.Write(",")
End If
Wend
----

 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      10-04-2006

"spolsky" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
>i use an application scope recordset


Don't do that!
http://www.aspfaq.com/show.asp?id=2053




> like one user is looping through the recordset for getting the list of
> online users while another one is getting online so adding a new
> record. ado recordset has a free and apartment threading model(marked
> ThreadingModel = Both in the registry) so i think it should handle the
> concurrency issues and recordset access will not be conflicted.


See above.


> otherwise, if it could not handle the concurrency i think
> - i should put that application scoped recordset into application
> collection and use application.lock/unlock methods.
> - or serializing the recordset access by an application variable and
>
> locking/unlocking the application for synchronization.
> what do you think about these ones?


SEE ABOVE!


> on the other hand, i know that there are different ways to hold and
> provide the list of online users using application variables, database
> etc. but i want to clarify the concept of application scope objects to
> myself. thus, is there be any concurrency problems with this method? if
>
> so what could
> be it done? also what about the efficiency of it?


SEE ABOVE!

Ray at work


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Lexical scope vs. dynamic scope Xah Lee Java 0 02-26-2009 10:08 AM
class objects, method objects, function objects 7stud Python 11 03-20-2007 06:05 PM
Scope - do I need two identical classes, each with different scope? ann Java 13 09-13-2005 03:07 AM
How do namespace scope and class scope differ? Steven T. Hatton C++ 9 07-19-2005 06:07 PM
IMPORT STATIC; Why is "import static" file scope? Why not class scope? Paul Opal Java 12 10-10-2004 11:01 PM



Advertisments