cf-talk  

Re: Possible thread issue?

Andre Kapp
Tue, 08 Dec 2009 19:56:37 -0800

> >Andre,
> >
> >Is this DAO a singleton?  I notice the queries aren't var scoped.  If 
> this
> >is a singleton under load another thread could easily overwrite your
> >trans_insert variable in between issuing the query and logging the 
> generated
> >key.
> >
> >Jaime
> >
> >
> >
> >>
> Tks Jaime.
> I have traced the code back to where this object is instantiated. It 
> pretty much looks like a singleton design!
> 
> This is the code just above this transdao.cfc
> 
> <cfcomponent name="TransService" output="false">
> 
>       <cffunction name="init" access="public" returntype="moneymaker.core.
> model.trans.TransService" output="false">
>               <cfreturn this />
>       </cffunction>
> 
>       <cffunction name="setTransDAO" returntype="void" access="public" 
> output="false">
>               <cfargument name="TransDAO" type="moneymaker.core.model.trans.
> TransDAO" required="true" />
>               <cfset variables.dao = arguments.TransDAO />
>       </cffunction>   
> 
>       <cffunction name="setTransGateway" returntype="void" access="public" 
> output="false">
>               <cfargument name="TransGateway" 
> type="moneymaker.core.model.trans.
> TransGateway" required="true" />
>               <cfset variables.gateway = arguments.TransGateway />
>       </cffunction>
>       
>       <cffunction name="getAll" returntype="query" access="public" 
> output="false">
>               <cfreturn variables.gateway.getAll() />
>       </cffunction>
    
> 
    
> <cffunction name="getLastTrans" returntype="query" access="public" 
> output="false">
>               <cfreturn variables.gateway.getLastTrans() />
>       </cffunction>
> 
    
> <cffunction name="getTransLimits" access="remote" 
> returntype="struct">
        
> <cfargument name="cardid" required="Yes" type="numeric" />
        
> <cfreturn variables.gateway.
> getTransLimits(argumentCollection=arguments) />
    
> </cffunction>
> 
    
> <cffunction name="processTransaction" access="remote" 
> returntype="struct">
        
> <cfargument name="acctid" required="Yes" type="numeric" />
        
> <cfargument name="cardid" required="Yes" type="numeric" />
        
> <cfargument name="cardnumber" required="Yes" type="numeric" />
        
> <cfargument name="amount" required="Yes" type="numeric" />
        
> <cfargument name="type" required="Yes" type="string" />
        
> <cfargument name="description" required="Yes" type="string" />
        
> <cfargument name="paytype" required="Yes" type="numeric" />
        
> <cfargument name="tracenumber" required="No" type="string" />
> 
>               
        
> <cfset arguments.stlimits = getTransLimits(arguments.cardid) />
        
> <cfreturn variables.dao.process(argumentCollection=arguments) />
> 
    
> </cffunction>
> 
> </cfcomponent>
> 
> I just want to prove that and then throw it back to the guys that 
> wrote the initial code. 
> 
> Tks again for all the help...! 


Just a quick question.

I'm much more familiar with the Java environment, so still learning the CF way.

Is there a way to get the classid value of the Java object that gets created by 
coldfusion? This will help me to dump the TransDAO classid when displaying the 
transid value. If the classid is the same, then it will prove the singleton 
implementation.

Tks
Andre


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328995
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4