super("job-executor");
}
public Object parse(Element element, Parse parse, Parser parser) {
// create a jobImpl executor object
JobExecutorDescriptor descriptor = new JobExecutorDescriptor();
// inject the command executor
if (element.hasAttribute("command-service")) {
descriptor.addInjection("commandService",
new ReferenceDescriptor(element.getAttribute("command-service"))
);
} else {
descriptor.addInjection("commandService",
new ReferenceDescriptor(CommandService.NAME_TX_REQUIRED_COMMAND_SERVICE)
);
}
if (element.hasAttribute("name")) {
descriptor.addInjection("name", new StringDescriptor(element.getAttribute("name")));
}
parseIntAttribute(element, "threads", descriptor, "nbrOfThreads", parse);
parseIntAttribute(element, "idle", descriptor, "idleMillis", parse);
parseIntAttribute(element, "idle-max", descriptor, "idleMillisMax", parse);
parseIntAttribute(element, "history", descriptor, "historySize", parse);
parseIntAttribute(element, "lock", descriptor, "lockMillis", parse);
// by default invoke the start method, unless auto-start is disabled
if (XmlUtil.attributeBoolean(element, "auto-start", false, parse, true)) {
InvokeOperation invokeStartOperation = new InvokeOperation();
invokeStartOperation.setMethodName("start");
descriptor.addOperation(invokeStartOperation);
descriptor.setAutoStart(true);
descriptor.setInit(AbstractDescriptor.INIT_EAGER);
}
return descriptor;
}