I tried, but couldn't come up with anything really useful.  Here's my post
that went to CF-Talk not too long ago (1/21/04):

If only it were as simple as:

<!--- MyThread.cfc --->
<cfcomponent extends="java.lang.Thread">
<cffunction name="run" access="public" returntype="any">
    <!--- do stuff that you don't need to wait for here, like launching an
.exe --->
</cffunction>
</cfcomponent>

<!--- .cfm page --->
<cfscript>
mt = createObject("Component", "MyThread");
mt.start();  // start is a method that would be inherited from Thread
</cfscript>

But alas, it's not that simple.  CFC's can't inherit from java classes..

So... in this situation it might make sense to create a Java wrapper that
extends thread, and lets us assign a function to run as the thread.  Maybe
something with a simple API like this..

<cffunction name="someFunction" ...>

<cfscript>
    ThreadWrapper = createObject("Java", "ThreadWrapper");
    ThreadWrapper.setMethodToRun(someFunction);
    ThreadWrapper.start();
</cfscript>

But I'm not sure have Java/CF play together with function references since
I've never tried passing one from CF to Java before.  If I get a chance,
I'll play around with this when I get home from work tonight.

-d

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to