Class RemoteCacheManager

java.lang.Object
org.infinispan.client.hotrod.RemoteCacheManager
All Implemented Interfaces:
Closeable, AutoCloseable, RemoteCacheManagerMXBean, RemoteCacheContainer, BasicCacheContainer, Lifecycle

public class RemoteCacheManager extends Object implements RemoteCacheContainer, Closeable, RemoteCacheManagerMXBean

Factory for RemoteCaches.

In order to be able to use a RemoteCache, the RemoteCacheManager must be started first: this instantiates connections to Hot Rod server(s). Starting the RemoteCacheManager can be done either at creation by passing start==true to the constructor or by using a constructor that does that for you; or after construction by calling start().

NOTE: this is an "expensive" object, as it manages a set of persistent TCP connections to the Hot Rod servers. It is recommended to only have one instance of this per JVM, and to cache it between calls to the server (i.e. remoteCache operations)

stop() needs to be called explicitly in order to release all the resources (e.g. threads, TCP connections).

Since:
4.1
Author:
Mircea.Markus@jboss.com
  • Field Details

  • Constructor Details

    • RemoteCacheManager

      public RemoteCacheManager(Configuration configuration)
      Create a new RemoteCacheManager using the supplied Configuration. The RemoteCacheManager will be started automatically
      Parameters:
      configuration - the configuration to use for this RemoteCacheManager
      Since:
      5.3
    • RemoteCacheManager

      public RemoteCacheManager(String uri)
      Create a new RemoteCacheManager using the supplied URI. The RemoteCacheManager will be started automatically
      Parameters:
      uri - the URI to use for this RemoteCacheManager
      Since:
      11.0
    • RemoteCacheManager

      public RemoteCacheManager(URI uri)
      Create a new RemoteCacheManager using the supplied URI. The RemoteCacheManager will be started automatically
      Parameters:
      uri - the URI to use for this RemoteCacheManager
      Since:
      11.0
    • RemoteCacheManager

      public RemoteCacheManager(Configuration configuration, boolean start)
      Create a new RemoteCacheManager using the supplied Configuration. The RemoteCacheManager will be started automatically only if the start parameter is true
      Parameters:
      configuration - the configuration to use for this RemoteCacheManager
      start - whether or not to start the manager on return from the constructor.
      Since:
      5.3
    • RemoteCacheManager

      public RemoteCacheManager(boolean start)

      Similar to RemoteCacheManager(Configuration, boolean), but it will try to lookup the config properties in the classpath, in a file named hotrod-client.properties. If no properties can be found in the classpath, defaults will be used, attempting to connect to 127.0.0.1:11222

      Refer to ConfigurationBuilder for a detailed list of available properties.

      Parameters:
      start - whether or not to start the RemoteCacheManager
      Throws:
      HotRodClientException - if such a file cannot be found in the classpath
    • RemoteCacheManager

      public RemoteCacheManager()
      Same as RemoteCacheManager(boolean) and it also starts the cache.
  • Method Details