Este contenido no está disponible en el idioma seleccionado.

3.4. Dynamic Reconfiguration


Dynamically changing the configuration of some options while the cache is running is supported, by programmatically obtaining the Configuration object from the running cache and changing values. E.g.,
   Configuration liveConfig = cache.getConfiguration();
   liveConfig.setLockAcquisitionTimeout(2000);
Copy to Clipboard Toggle word wrap
A complete listing of which options may be changed dynamically is in the Section 12.2, “Configuration File Quick Reference” section. An org.jboss.cache.config.ConfigurationException will be thrown if you attempt to change a setting that is not dynamic.

3.4.1. Overriding the Configuration via the Option API

The Option API allows you to override certain behaviors of the cache on a per invocation basis. This involves creating an instance of org.jboss.cache.config.Option , setting the options you wish to override on the Option object and passing it in the InvocationContext before invoking your method on the cache.
E.g., to force a write lock when reading data (when used in a transaction, this provides semantics similar to SELECT FOR UPDATE in a database)
      // first start a transaction
      cache.getInvocationContext().getOptionOverrides().setForceWriteLock(true);
      Node n = cache.getNode(Fqn.fromString("/a/b/c"));
      // make changes to the node
      // commit transaction
Copy to Clipboard Toggle word wrap
E.g., to suppress replication of a put call in a REPL_SYNC cache:
      Node node = cache.getChild(Fqn.fromString("/a/b/c"));
      cache.getInvocationContext().getOptionOverrides().setLocalOnly(true);
      node.put("localCounter", new Integer(2));
Copy to Clipboard Toggle word wrap
See the Javadocs on the Option class for details on the options available.
Volver arriba
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. Explore nuestras recientes actualizaciones.

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.

Theme

© 2025 Red Hat