org.infinispan.client.hotrod
Class RemoteCacheManager

java.lang.Object
  extended by org.infinispan.client.hotrod.RemoteCacheManager
All Implemented Interfaces:
Lifecycle, CacheContainer

public class RemoteCacheManager
extends Object
implements CacheContainer, Lifecycle

// TODO: Document this

Since:
4.1
Author:
mmarkus

Field Summary
static String CONF_HOTROD_SERVERS
           
static String HOTROD_CLIENT_PROPERTIES
           
static String OVERRIDE_HOTROD_SERVERS
           
 
Constructor Summary
RemoteCacheManager()
          Same as RemoteCacheManager(boolean) and it also starts the cache.
RemoteCacheManager(boolean start)
          Same as RemoteCacheManager(java.util.Properties), but it will try to lookup the config properties in the classpath, in a file named hotrod-client.properties.
RemoteCacheManager(Properties props)
          Same as RemoteCacheManager(java.util.Properties, boolean), and it also starts the cache (start==true).
RemoteCacheManager(Properties props, boolean start)
          Build a cache manager based on supplied given properties.
RemoteCacheManager(String servers)
          Same as RemoteCacheManager(String, boolean), with start=true.
RemoteCacheManager(String servers, boolean start)
          The given string should have the following structure: "host1:port2;host:port2...".
RemoteCacheManager(String host, int port)
          Same as RemoteCacheManager(String, int) with start=true.
RemoteCacheManager(String host, int port, boolean start)
          Creates a remote cache manager aware of the hotrod server listening at host:port.
RemoteCacheManager(URL config)
          Same as RemoteCacheManager(java.net.URL) and it also starts the cache (start==true).
RemoteCacheManager(URL config, boolean start)
          Same as RemoteCacheManager(java.util.Properties), but it will try to lookup the config properties in supplied URL.
 
Method Summary
<K,V> RemoteCache<K,V>
getCache()
          Retrieves the default cache associated with this cache container.
<K,V> RemoteCache<K,V>
getCache(boolean forceReturnValue)
           
<K,V> RemoteCache<K,V>
getCache(String cacheName)
          Retrieves a named cache from the system.
<K,V> RemoteCache<K,V>
getCache(String cacheName, boolean forceReturnValue)
           
 boolean isStarted()
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HOTROD_CLIENT_PROPERTIES

public static final String HOTROD_CLIENT_PROPERTIES
See Also:
Constant Field Values

CONF_HOTROD_SERVERS

public static final String CONF_HOTROD_SERVERS
See Also:
Constant Field Values

OVERRIDE_HOTROD_SERVERS

public static final String OVERRIDE_HOTROD_SERVERS
See Also:
Constant Field Values
Constructor Detail

RemoteCacheManager

public RemoteCacheManager(Properties props,
                          boolean start)
Build a cache manager based on supplied given properties. TODO - add a list of all possible configuration parameters here


RemoteCacheManager

public RemoteCacheManager(Properties props)
Same as RemoteCacheManager(java.util.Properties, boolean), and it also starts the cache (start==true).


RemoteCacheManager

public RemoteCacheManager(boolean start)
Same as RemoteCacheManager(java.util.Properties), but it will try to lookup the config properties in the classpath, in a file named hotrod-client.properties.

Parameters:
start - weather 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.


RemoteCacheManager

public RemoteCacheManager(String host,
                          int port,
                          boolean start)
Creates a remote cache manager aware of the hotrod server listening at host:port.

Parameters:
start - weather or not to start the RemoteCacheManager.

RemoteCacheManager

public RemoteCacheManager(String host,
                          int port)
Same as RemoteCacheManager(String, int) with start=true.


RemoteCacheManager

public RemoteCacheManager(String servers,
                          boolean start)
The given string should have the following structure: "host1:port2;host:port2...". Every host:port defines a server.


RemoteCacheManager

public RemoteCacheManager(String servers)
Same as RemoteCacheManager(String, boolean), with start=true.


RemoteCacheManager

public RemoteCacheManager(URL config,
                          boolean start)
Same as RemoteCacheManager(java.util.Properties), but it will try to lookup the config properties in supplied URL.

Parameters:
start - weather or not to start the RemoteCacheManager
Throws:
HotRodClientException - if properties could not be loaded

RemoteCacheManager

public RemoteCacheManager(URL config)
Same as RemoteCacheManager(java.net.URL) and it also starts the cache (start==true).

Parameters:
config -
Method Detail

getCache

public <K,V> RemoteCache<K,V> getCache(String cacheName)
Description copied from interface: CacheContainer
Retrieves a named cache from the system. If the cache has been previously created with the same name, the running cache instance is returned. Otherwise, this method attempts to create the cache first.

In the case of a CacheManager: when creating a new cache, this method will use the configuration passed in to the CacheManager on construction, as a template, and then optionally apply any overrides previously defined for the named cache using the CacheManager.defineConfiguration(String, org.infinispan.config.Configuration) or CacheManager.defineConfiguration(String, String, org.infinispan.config.Configuration) methods, or declared in the configuration file.

NB: Shared caches are supported (and in fact encouraged) but if they are used it's the users responsibility to ensure that at least one but only one caller calls stop() on the cache, and it does so with the awareness that others may be using the cache.

Specified by:
getCache in interface CacheContainer
Parameters:
cacheName - name of cache to retrieve
Returns:
a cache instance identified by cacheName

getCache

public <K,V> RemoteCache<K,V> getCache(String cacheName,
                                       boolean forceReturnValue)

getCache

public <K,V> RemoteCache<K,V> getCache()
Description copied from interface: CacheContainer
Retrieves the default cache associated with this cache container.

As such, this method is always guaranteed to return the default cache.

NB: Shared caches are supported (and in fact encouraged) but if they are used it's the users responsibility to ensure that at least one but only one caller calls stop() on the cache, and it does so with the awareness that others may be using the cache.

Specified by:
getCache in interface CacheContainer
Returns:
the default cache.

getCache

public <K,V> RemoteCache<K,V> getCache(boolean forceReturnValue)

start

public void start()
Specified by:
start in interface Lifecycle

stop

public void stop()
Specified by:
stop in interface Lifecycle

isStarted

public boolean isStarted()

Google Analytics

Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.