因此,经过反复摆弄之后,我提出了一个适当的解决方案,尽管它并没有产生我希望的性能提升(仅提高了10%)。
该解决方案特定于Scala / Lift /
Json,包含在scriptingUtil.scala文件中。
总结一下:
- Context.javaToJs()似乎并非在所有情况下都有效。(
java.lang.RuntimeException: No Context associated with current Thread
) - 需要一个“作用域”类型的对象
scriptable
。我想出的解决方案不是很好,但可以。 - 创建一个NativeArray:
val na = new NativeArray(arr)
na.setPrototype(scriptableObject.getClassPrototype(scope, “Array”))
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)