Search in sources :

Example 1 with AsyncPool

use of org.apache.jena.fuseki.async.AsyncPool in project jena by apache.

the class ActionTasks method execGet.

private void execGet(HttpAction action, String name) {
    if (name == null)
        log.info(format("[%d] Tasks", action.id));
    else
        log.info(format("[%d] Task %s", action.id, name));
    JsonValue responseBody = null;
    if (name == null) {
        JsonBuilder builder = new JsonBuilder();
        builder.startArray();
        for (AsyncPool pool : pools) {
            for (AsyncTask aTask : pool.tasks()) {
                //builder.value(aTask.getTaskId()) ;
                descOneTask(builder, aTask);
            }
        }
        builder.finishArray();
        responseBody = builder.build();
    } else {
        for (AsyncPool pool : pools) {
            // Assumes first is only.
            AsyncTask aTask = pool.getTask(name);
            if (aTask != null) {
                JsonBuilder builder = new JsonBuilder();
                descOneTask(builder, aTask);
                responseBody = builder.build();
            }
        }
    }
    if (responseBody == null)
        ServletOps.errorNotFound("Task '" + name + "' not found");
    ServletOps.setNoCache(action);
    ServletOps.sendJsonReponse(action, responseBody);
}
Also used : JsonBuilder(org.apache.jena.atlas.json.JsonBuilder) JsonValue(org.apache.jena.atlas.json.JsonValue) AsyncTask(org.apache.jena.fuseki.async.AsyncTask) AsyncPool(org.apache.jena.fuseki.async.AsyncPool)

Aggregations

JsonBuilder (org.apache.jena.atlas.json.JsonBuilder)1 JsonValue (org.apache.jena.atlas.json.JsonValue)1 AsyncPool (org.apache.jena.fuseki.async.AsyncPool)1 AsyncTask (org.apache.jena.fuseki.async.AsyncTask)1