How identifying my CFTHREAD?

a run a new CFTHREAD in a script, and i want to check it’s state from another script.

Before, a used in ACF 11 this object :
allThreads = new CFIDE.adminapi.servermonitoring().getAllActiveCFThreads();
and search the name of my thread in the CFTHREADNAME attribute.

But now in Lucee, i use :
allStackTraces = createObject(“java”, “java.lang.Thread”).getAllStackTraces();

And when i list the names of the threads, i only find a lot of “cfthread-999”, but NEVER the given name for my CFTHREAD (all scripts share the same Lucee context, if it’s important ?)

How can i do ?

in Lucee 6, threads are named :slight_smile:

but… when LUCEE 6 will be available ?

Another way would be to stock in DB the ID of the thread when i lauch it.
Is it possible ?

6 is a way off yet

you might be able to set the thread name, from within the thread using java?

Yes !
A code like this run fine:

thread name=“aName” action=“run” {
Thread = createObject(“java”, “java.lang.Thread”);
name = Thread.currentThread().getName();
id = hread.currentThread().getId();

Thanks !

1 Like