added getThreads() function
This commit is contained in:
parent
da000151d0
commit
5ada1c1876
1 changed files with 10 additions and 0 deletions
|
@ -23,6 +23,7 @@ public class ESAppNode extends ESNode {
|
||||||
app = eval.app;
|
app = eval.app;
|
||||||
createtime = new DatePrototype (eval.evaluator, node.created());
|
createtime = new DatePrototype (eval.evaluator, node.created());
|
||||||
FunctionPrototype fp = (FunctionPrototype) eval.evaluator.getFunctionPrototype();
|
FunctionPrototype fp = (FunctionPrototype) eval.evaluator.getFunctionPrototype();
|
||||||
|
putHiddenProperty("getThreads", new AppCountThreads ("getThreads", evaluator, fp));
|
||||||
putHiddenProperty("getMaxThreads", new AppCountEvaluators ("getMaxThreads", evaluator, fp));
|
putHiddenProperty("getMaxThreads", new AppCountEvaluators ("getMaxThreads", evaluator, fp));
|
||||||
putHiddenProperty("getFreeThreads", new AppCountFreeEvaluators ("getFreeThreads", evaluator, fp));
|
putHiddenProperty("getFreeThreads", new AppCountFreeEvaluators ("getFreeThreads", evaluator, fp));
|
||||||
putHiddenProperty("getActiveThreads", new AppCountBusyEvaluators ("getActiveThreads", evaluator, fp));
|
putHiddenProperty("getActiveThreads", new AppCountBusyEvaluators ("getActiveThreads", evaluator, fp));
|
||||||
|
@ -89,6 +90,15 @@ public class ESAppNode extends ESNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AppCountThreads extends BuiltinFunctionObject {
|
||||||
|
AppCountThreads (String name, Evaluator evaluator, FunctionPrototype fp) {
|
||||||
|
super (fp, evaluator, name, 0);
|
||||||
|
}
|
||||||
|
public ESValue callFunction (ESObject thisObject, ESValue[] arguments) throws EcmaScriptException {
|
||||||
|
return new ESNumber (app.threadgroup.activeCount() -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class AppSetNumberOfEvaluators extends BuiltinFunctionObject {
|
class AppSetNumberOfEvaluators extends BuiltinFunctionObject {
|
||||||
AppSetNumberOfEvaluators (String name, Evaluator evaluator, FunctionPrototype fp) {
|
AppSetNumberOfEvaluators (String name, Evaluator evaluator, FunctionPrototype fp) {
|
||||||
super (fp, evaluator, name, 1);
|
super (fp, evaluator, name, 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue