Search in sources :

Example 6 with TaskManager

use of org.infinispan.tasks.TaskManager in project infinispan by infinispan.

the class LoggingResource method setLogger.

private CompletionStage<RestResponse> setLogger(RestRequest request) {
    TaskManager taskManager = invocationHelper.getServer().getTaskManager();
    String loggerName = request.variables().get("loggerName");
    String level = request.getParameter("level");
    List<String> appenders = request.parameters().get("appender");
    if (level == null && appenders == null) {
        return completedFuture(new NettyRestResponse.Builder().status(HttpResponseStatus.BAD_REQUEST).build());
    }
    return taskManager.runTask("@@logging@set", new TaskContext().addOptionalParameter("loggerName", loggerName).addOptionalParameter("level", level).addOptionalParameter("appenders", appenders).subject(request.getSubject())).handle((o, t) -> handle(t));
}
Also used : TaskManager(org.infinispan.tasks.TaskManager) TaskContext(org.infinispan.tasks.TaskContext) NettyRestResponse(org.infinispan.rest.NettyRestResponse)

Aggregations

TaskManager (org.infinispan.tasks.TaskManager)6 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)3 TaskContext (org.infinispan.tasks.TaskContext)3 CompletionStage (java.util.concurrent.CompletionStage)2 NettyRestResponse (org.infinispan.rest.NettyRestResponse)2 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 ObjectInput (java.io.ObjectInput)1 ObjectOutput (java.io.ObjectOutput)1 URL (java.net.URL)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 PrivilegedActionException (java.security.PrivilegedActionException)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Properties (java.util.Properties)1