[cfaussie] Re: Object Locking

2007-06-05 Thread Mark Mandel

Dale,

Assuming the object is thread safe, no.

Mark

On 6/6/07, Dale Fraser [EMAIL PROTECTED] wrote:




 This might be a dumb question.



 But if I create an instance of an Object at Application level, such as a
 logging Object.



 Then I want to invoke the log method on every action of every page, do I
 need to lock the object before invoking the log method.



 Ie



 cfset application.Logger = createObject('component',
 'com.company.data.Logger.init()' /



 Then from other pages



 cfset result = applicationer.Logger.log(username, datetime, event) /



 Or would the cfset need to have a lock around it.



 Regards

 Dale Fraser



 http://dalefraser.blogspot.com


  



-- 
E: [EMAIL PROTECTED]
W: www.compoundtheory.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: Object Locking

2007-06-05 Thread Andrew Scott
Dale,

 

This has been discussed many times, and the debate still rages about race
conditions.

 

The answer to your question will depend on whether a race condition will
occur. What I have done in the past is done a cflock around global variables
within the cfc when being set. This will do two things, one the request is
halted until it is finished by a predecessor and secondly you do not need to
worry about locking outside your package.

 

Think thread safe.

 

 



Andrew Scott
Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613  8676 4223
Mobile: 0404 998 273

 

 

From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Dale Fraser
Sent: Wednesday, 6 June 2007 12:28 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Object Locking

 

This might be a dumb question.

 

But if I create an instance of an Object at Application level, such as a
logging Object.

 

Then I want to invoke the log method on every action of every page, do I
need to lock the object before invoking the log method.

 

Ie

 

cfset application.Logger = createObject('component',
'com.company.data.Logger.init()' /

 

Then from other pages

 

cfset result = applicationer.Logger.log(username, datetime, event) /

 

Or would the cfset need to have a lock around it.

 

Regards

Dale Fraser

 

http://dalefraser.blogspot.com

 



 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: Object Locking

2007-06-05 Thread Dale Fraser
Ok,

 

So thread safe, I'm not really sure what this means. Well I know what it
means, but what would be an example of something that's not thread safe so
that I can think if my example would be safe.

 

My thinking is that if the call to the object doesn't modify the object it's
self then it's safe, is that right.

 

Regards

Dale Fraser

 

 http://dalefraser.blogspot.com http://dalefraser.blogspot.com

 

From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Andrew Scott
Sent: Wednesday, 6 June 2007 12:33 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Object Locking

 

Dale,

 

This has been discussed many times, and the debate still rages about race
conditions.

 

The answer to your question will depend on whether a race condition will
occur. What I have done in the past is done a cflock around global variables
within the cfc when being set. This will do two things, one the request is
halted until it is finished by a predecessor and secondly you do not need to
worry about locking outside your package.

 

Think thread safe.

 

 



Andrew Scott
Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613  8676 4223
Mobile: 0404 998 273

 

 

From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Dale Fraser
Sent: Wednesday, 6 June 2007 12:28 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Object Locking

 

This might be a dumb question.

 

But if I create an instance of an Object at Application level, such as a
logging Object.

 

Then I want to invoke the log method on every action of every page, do I
need to lock the object before invoking the log method.

 

Ie

 

cfset application.Logger = createObject('component',
'com.company.data.Logger.init()' /

 

Then from other pages

 

cfset result = applicationer.Logger.log(username, datetime, event) /

 

Or would the cfset need to have a lock around it.

 

Regards

Dale Fraser

 

http://dalefraser.blogspot.com

 

 

 



 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: Object Locking

2007-06-05 Thread Mark Mandel

http://www.google.com.au/search?source=ighl=enq=CFC+thread+safebtnG=Google+Searchmeta=

Mark

On 6/6/07, Dale Fraser [EMAIL PROTECTED] wrote:




 Ok,



 So thread safe, I'm not really sure what this means. Well I know what it
 means, but what would be an example of something that's not thread safe so
 that I can think if my example would be safe.



 My thinking is that if the call to the object doesn't modify the object it's
 self then it's safe, is that right.




 Regards

 Dale Fraser



 http://dalefraser.blogspot.com





 From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
 Of Andrew Scott
  Sent: Wednesday, 6 June 2007 12:33 PM
  To: cfaussie@googlegroups.com
  Subject: [cfaussie] Re: Object Locking




 Dale,



 This has been discussed many times, and the debate still rages about race
 conditions.



 The answer to your question will depend on whether a race condition will
 occur. What I have done in the past is done a cflock around global variables
 within the cfc when being set. This will do two things, one the request is
 halted until it is finished by a predecessor and secondly you do not need to
 worry about locking outside your package.



 Think thread safe.








  Andrew Scott
  Senior Coldfusion Developer
  Aegeon Pty. Ltd.
  www.aegeon.com.au
  Phone: +613  8676 4223
  Mobile: 0404 998 273







 From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
 Of Dale Fraser
  Sent: Wednesday, 6 June 2007 12:28 PM
  To: cfaussie@googlegroups.com
  Subject: [cfaussie] Object Locking



 This might be a dumb question.



 But if I create an instance of an Object at Application level, such as a
 logging Object.



 Then I want to invoke the log method on every action of every page, do I
 need to lock the object before invoking the log method.



 Ie



 cfset application.Logger = createObject('component',
 'com.company.data.Logger.init()' /



 Then from other pages



 cfset result = applicationer.Logger.log(username, datetime, event) /



 Or would the cfset need to have a lock around it.



 Regards

 Dale Fraser



 http://dalefraser.blogspot.com












  



-- 
E: [EMAIL PROTECTED]
W: www.compoundtheory.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: Object Locking

2007-06-05 Thread Dale Fraser

Ahh,

Thats funny, would have just been easier to give me your page ;)

So we do all that local var stuff, thus should be good.

Regards
Dale Fraser

http://dalefraser.blogspot.com


-Original Message-
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Mark Mandel
Sent: Wednesday, 6 June 2007 12:52 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Object Locking


http://www.google.com.au/search?source=ighl=enq=CFC+thread+safebtnG=Googl
e+Searchmeta=

Mark

On 6/6/07, Dale Fraser [EMAIL PROTECTED] wrote:




 Ok,



 So thread safe, I'm not really sure what this means. Well I know what it
 means, but what would be an example of something that's not thread safe so
 that I can think if my example would be safe.



 My thinking is that if the call to the object doesn't modify the object
it's
 self then it's safe, is that right.




 Regards

 Dale Fraser



 http://dalefraser.blogspot.com





 From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf
 Of Andrew Scott
  Sent: Wednesday, 6 June 2007 12:33 PM
  To: cfaussie@googlegroups.com
  Subject: [cfaussie] Re: Object Locking




 Dale,



 This has been discussed many times, and the debate still rages about race
 conditions.



 The answer to your question will depend on whether a race condition will
 occur. What I have done in the past is done a cflock around global
variables
 within the cfc when being set. This will do two things, one the request is
 halted until it is finished by a predecessor and secondly you do not need
to
 worry about locking outside your package.



 Think thread safe.








  Andrew Scott
  Senior Coldfusion Developer
  Aegeon Pty. Ltd.
  www.aegeon.com.au
  Phone: +613  8676 4223
  Mobile: 0404 998 273







 From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf
 Of Dale Fraser
  Sent: Wednesday, 6 June 2007 12:28 PM
  To: cfaussie@googlegroups.com
  Subject: [cfaussie] Object Locking



 This might be a dumb question.



 But if I create an instance of an Object at Application level, such as a
 logging Object.



 Then I want to invoke the log method on every action of every page, do I
 need to lock the object before invoking the log method.



 Ie



 cfset application.Logger = createObject('component',
 'com.company.data.Logger.init()' /



 Then from other pages



 cfset result = applicationer.Logger.log(username, datetime, event) /



 Or would the cfset need to have a lock around it.



 Regards

 Dale Fraser



 http://dalefraser.blogspot.com












  



-- 
E: [EMAIL PROTECTED]
W: www.compoundtheory.com





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: Object Locking

2007-06-05 Thread Andrew Scott

And Race Conditions as well Dale...

That is also a must when changing any variable that can be changed within a
thread and is global to that thread, while that thread is running. For
example you may have a global variable, that is changed and dependant on the
thread running at the time and another thread comes along and changes that
variable while your thread is still running. This can cause undesired
results.

Example:

cfcomponent

 cfset variables.IsOpen = true /

 cffunction name=testThread
  cfif variables.IsOpen
   . if one thread is reliant on this variable condition, and it is
changed
 by another thread then the results can be very unexpected.
  /cfif
 /cffunction
/cfcomponent

Race conditions are almost non existant, but the above scenario can happen.


Andrew Scott
Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613  8676 4223
Mobile: 0404 998 273



-Original Message-
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Dale Fraser
Sent: Wednesday, 6 June 2007 1:03 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Object Locking


Ahh,

Thats funny, would have just been easier to give me your page ;)

So we do all that local var stuff, thus should be good.

Regards
Dale Fraser

http://dalefraser.blogspot.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---