在Coldfusion线程中使用函数参数



如何在Coldfusion线程中使用函数参数?我不明白为什么我得到以下错误:

元素SOMEID在参数中未定义。

我的代码的简化示例。

public any function createSomeEntity(required numeric someId) {     
thread action="run" name="someThread" {
var result = someFunction(someId = arguments.someId);
// some logic
}
thread action="join" name="someThread" timeout="5000";

if (someThread.status != "COMPLETED") {
// action 1
} else {
// action 2
}
}       

您需要将变量作为的属性传递给线程,线程无法访问参数范围。

thread
action="run"
name="someThread"
someId = arguments.someId
^^^^^^^^^^^^^^^^^^^^^^^^^
{
result = someFunction(someId = attributes.someId);
^^^^^^^^^^
// some logic
}

最新更新