Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java object issue

Status
Not open for further replies.

da644

Programmer
May 21, 2001
159
GB
Hi.

I having a problem with a Java object call. It appears that the CF server does not create the objects exclusively when more than one instance of the same script is running. I have created a java class to do multi-threaded XML post to a web service. The java class works fine and everything is great if you only call the script once. If you call it more that once at the same time it appears that a new instance is the same as the other instance. Here is a code segment of how I'm creating the object.

<cfscript>
obj_PostXML = CreateObject('java', 'MultiThreadedXMLPost').init();
obj_PostXML.executePost(arr_Arguments);
while(obj_PostXML.completedCount LT 2) {}
str_output = obj_PostXML.theData;
</cfscript>
<cfdump var="#str_output#">

Is there anyway to make it exclusive?

Kind regards,

Andrew.
 

You could try instanciating the object into the session scope, this way the obejct would be available per user request.

something like:

<cfset session.obj_PostXML = createobject("java","MultiThreadedXMLPost")>

hope this helps!

Tony
 
It's ok, I found the solution to the problem, it was not CF at all, it was Java. The object class was defined as static. I removed this and recompiled and it now works fine.

Kind regards,

Andrew.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top