use of act.util.ProgressGauge in project actframework by actframework.
the class ReflectedCommandExecutor method execute.
@Override
public Object execute(CliContext context) {
context.handlerMethod(method);
if (null != dateFormatPattern) {
context.dateFormatPattern(dateFormatPattern);
}
context.fastjsonFeatures(features);
context.fastjsonFilters(filters);
context.prepare(parsingContext);
paramLoaderService.preParseOptions(method, methodMetaInfo, context);
final Object cmd = commanderInstance(context);
final Object[] params = params(cmd, context);
if (async) {
JobManager jobManager = context.app().jobManager();
String jobId = jobManager.prepare(new TrackableWorker() {
@Override
protected void run(ProgressGauge progressGauge) {
invoke(cmd, params);
}
});
context.setJobId(jobId);
jobManager.now(jobId);
if (null != reportProgress) {
context.attribute(ReportProgress.CTX_ATTR_KEY, reportProgress);
return context.progress();
} else {
return "Async job started: " + jobId;
}
}
return invoke(cmd, params);
}
Aggregations