Este contenido no está disponible en el idioma seleccionado.

Chapter 32. Remote Task Execution


Tasks, or business logic, may be executed directly on JBoss Data Grid servers, allowing this logic to be executed close to the data and using the resources of all nodes in the cluster. These tasks may be bundled in java executables which are deployed to the server instances, and once deployed the tasks may be executed programmatically.

32.1. Creating a Remote Task

To create a task for remote execution a .jar file must be created containing a class that implements org.infinispan.tasks.ServerTask. This interface contains the following methods that must be implemented:
  • void setTaskContext(TaskContext taskContext) - sets the task context; should be used to access caches and other resources necessary.
  • String getName() - provides a unique name for the task. This is the name that will be used for execution by the TaskManager.
In addition to the above the following may be implemented; however, these are not required for execution:
  • TaskExecutionMethod getExecutionMode() - Determines if the task is executed on one node, TaskExecutionMode.ONE_NODE, or on all nodes, TaskExecutionMode.ALL_NODES. Execution on one node is enabled by default.
  • Optional<String> getAllowedRole() - Sets the role that may execute this task. By default no role is provided, indicating that no additional role is required for execution. Additional information on executing tasks is found in Section 32.4, “Running Remote Tasks”.
  • Set<String> getParameters() - A collection of named parameters for use with the task.
Red Hat logoGithubRedditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

© 2024 Red Hat, Inc.