The Task structure provides a context to most midPoint operations and functions. It contains contextual information such as identity of the user that invoked the operation, it contains security context, it may be bound to scheduling data and so on. It also holds the operation result data structure. Each "business" operation in midPoint should be executed in a context of a task.
Tasks are managed by Task Manager component. The task manager creates the tasks and manages the lifecycle of tasks. Task manager can create broad range of tasks from lightweight synchronous tasks to a persistent asynchronous and scheduled tasks. See the Task Manager page for more details.
TODO: java example how to create and use task