I have a JavaBean API that i use to Connect to our DB via an Object Server(RedBack Business Objects)
 
The Constructor Increments a Static variable everytime an Object is Instanciated from the API.
 
private static int objCount;
public RedBackObect{
objCount++;
}
 
I am looking track DB Usage from the NO of Objects created and do some stess testing as well.
Now.. If the objects are invoked in a CFC - CFFunctions like
 
<cfset var rbo = "" />
<cfscript>
rbo = createObect("Java","RedBackObject").init(); // this should call the default contructor
//do some stuff with the rbo.
objCount = rbo.getObjectCount(); // static method in API
rbo.closeObj();
rbo="";
</cfscript>
 
objCount = 1, which is not right cause the object was instantiated several times.
 
rbo = createObect("Java","RedBackObject").init(); AND rbo = createObect("Java","RedBackObject")
Both call the default contructor right Or do you have to explicitly say "init()"?
 
If the Class gets loaded only once, then i should get the correct object count.
 
Can anybody explain whats going on in CF Object Creation?
 
Thanks,
Joe Eugene

Reply via email to