|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.infinispan.client.hotrod.RemoteCacheManager
public class RemoteCacheManager
Factory for RemoteCache
s.
Lifecycle:
In order to be able to use anRemoteCache
, the RemoteCacheManager
must be started first: beside other things, this instantiates connections to Hot Rod server(s). Starting the RemoteCacheManager
can be done either at creation by passing start==true to constructor
or by using a constructor that does that for you (see C-tor documentation); or after construction by calling start()
.
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).
Configuration:
The cache manager is configured through a Properties
object passed to the constructor (there are also
"simplified" constructors that rely on default values).
Below is the list of supported configuration elements:
Flag.FORCE_RETURN_VALUE
for all calls.Marshaller
implementation to serialize and deserialize user objects. For portable serialization payloads, you should configure the marshaller to be ApacheAvroMarshaller
ConsistentHashFactory
. This specifies the version of the hash function and consistent hash algorithm in use, and is closely tied with the HotRod server version used.
Field Summary | |
---|---|
static String |
HOTROD_CLIENT_PROPERTIES
|
Fields inherited from interface org.infinispan.api.BasicCacheContainer |
---|
DEFAULT_CACHE_NAME |
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(Marshaller marshaller,
Properties props)
Same as RemoteCacheManager(Marshaller, java.util.Properties, boolean) with start = true. |
|
RemoteCacheManager(Marshaller marshaller,
Properties props,
boolean start)
Builds a remote cache manager that relies on the provided Marshaller for marshalling
keys and values to be send over to the remote Infinispan cluster. |
|
RemoteCacheManager(Marshaller marshaller,
Properties props,
boolean start,
ClassLoader classLoader,
ExecutorFactory asyncExecutorFactory)
Builds a remote cache manager that relies on the provided Marshaller for marshalling
keys and values to be send over to the remote Infinispan cluster. |
|
RemoteCacheManager(Marshaller marshaller,
Properties props,
ClassLoader classLoader)
Same as RemoteCacheManager(Marshaller, java.util.Properties, boolean) with start = true. |
|
RemoteCacheManager(Marshaller marshaller,
Properties props,
ExecutorFactory asyncExecutorFactory)
Same as RemoteCacheManager(Marshaller, java.util.Properties, boolean) with start = true. |
|
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 properties. |
|
RemoteCacheManager(Properties props,
boolean start,
ClassLoader classLoader,
ExecutorFactory asyncExecutorFactory)
Build a cache manager based on supplied properties. |
|
RemoteCacheManager(Properties props,
ClassLoader classLoader)
Same as RemoteCacheManager(java.util.Properties, boolean) , and it also starts the cache (start==true). |
|
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 servers,
boolean start,
ClassLoader classLoader)
The given string should have the following structure: "host1:port2;host:port2...". |
|
RemoteCacheManager(String servers,
ClassLoader classLoader)
Same as RemoteCacheManager(String, boolean) , with start=true. |
|
RemoteCacheManager(String host,
int port)
Same as RemoteCacheManager(String, int, boolean) with start=true. |
|
RemoteCacheManager(String host,
int port,
boolean start)
Creates a remote cache manager aware of the Hot Rod server listening at host:port. |
|
RemoteCacheManager(String host,
int port,
boolean start,
ClassLoader classLoader)
Creates a remote cache manager aware of the Hot Rod server listening at host:port. |
|
RemoteCacheManager(String host,
int port,
ClassLoader classLoader)
Same as RemoteCacheManager(String, int, boolean) with start=true. |
|
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. |
|
RemoteCacheManager(URL config,
boolean start,
ClassLoader classLoader)
Same as RemoteCacheManager(java.util.Properties) , but it will try to lookup the config properties in
supplied URL. |
|
RemoteCacheManager(URL config,
ClassLoader classLoader)
Same as RemoteCacheManager(java.net.URL) and it also starts the cache (start==true). |
Method Summary | ||
---|---|---|
|
getCache()
Retrieves the default cache from the remote server. |
|
|
getCache(boolean forceReturnValue)
|
|
|
getCache(String cacheName)
Retrieves a named cache from the remote server if the cache has been defined, otherwise if the cache name is underfined, it will return null. |
|
|
getCache(String cacheName,
boolean forceReturnValue)
|
|
Properties |
getProperties()
Retrieves a clone of the properties currently in use. |
|
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 |
---|
public static final String HOTROD_CLIENT_PROPERTIES
Constructor Detail |
---|
public RemoteCacheManager(Marshaller marshaller, Properties props, boolean start)
Marshaller
for marshalling
keys and values to be send over to the remote Infinispan cluster.
marshaller
- marshaller implementation to be usedprops
- other propertiesstart
- weather or not to start the manager on return from the constructor.public RemoteCacheManager(Marshaller marshaller, Properties props, boolean start, ClassLoader classLoader, ExecutorFactory asyncExecutorFactory)
Marshaller
for marshalling
keys and values to be send over to the remote Infinispan cluster.
marshaller
- marshaller implementation to be usedprops
- other propertiesstart
- weather or not to start the manager on return from the constructor.public RemoteCacheManager(Marshaller marshaller, Properties props)
RemoteCacheManager(Marshaller, java.util.Properties, boolean)
with start = true.
public RemoteCacheManager(Marshaller marshaller, Properties props, ExecutorFactory asyncExecutorFactory)
RemoteCacheManager(Marshaller, java.util.Properties, boolean)
with start = true.
public RemoteCacheManager(Marshaller marshaller, Properties props, ClassLoader classLoader)
RemoteCacheManager(Marshaller, java.util.Properties, boolean)
with start = true.
public RemoteCacheManager(Properties props, boolean start)
public RemoteCacheManager(Properties props, boolean start, ClassLoader classLoader, ExecutorFactory asyncExecutorFactory)
public RemoteCacheManager(Properties props)
RemoteCacheManager(java.util.Properties, boolean)
, and it also starts the cache (start==true).
public RemoteCacheManager(Properties props, ClassLoader classLoader)
RemoteCacheManager(java.util.Properties, boolean)
, and it also starts the cache (start==true).
public RemoteCacheManager(boolean start)
RemoteCacheManager(java.util.Properties)
, 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, the
server tries to connect to "127.0.0.1:11222" in start.
start
- weather or not to start the RemoteCacheManager
HotRodClientException
- if such a file cannot be found in the classpathpublic RemoteCacheManager()
RemoteCacheManager(boolean)
and it also starts the cache.
public RemoteCacheManager(String host, int port, boolean start)
start
- weather or not to start the RemoteCacheManager.public RemoteCacheManager(String host, int port, boolean start, ClassLoader classLoader)
start
- weather or not to start the RemoteCacheManager.public RemoteCacheManager(String host, int port)
RemoteCacheManager(String, int, boolean)
with start=true.
public RemoteCacheManager(String host, int port, ClassLoader classLoader)
RemoteCacheManager(String, int, boolean)
with start=true.
public RemoteCacheManager(String servers, boolean start)
public RemoteCacheManager(String servers, boolean start, ClassLoader classLoader)
public RemoteCacheManager(String servers)
RemoteCacheManager(String, boolean)
, with start=true.
public RemoteCacheManager(String servers, ClassLoader classLoader)
RemoteCacheManager(String, boolean)
, with start=true.
public RemoteCacheManager(URL config, boolean start)
RemoteCacheManager(java.util.Properties)
, but it will try to lookup the config properties in
supplied URL.
start
- weather or not to start the RemoteCacheManager
HotRodClientException
- if properties could not be loadedpublic RemoteCacheManager(URL config, boolean start, ClassLoader classLoader)
RemoteCacheManager(java.util.Properties)
, but it will try to lookup the config properties in
supplied URL.
start
- weather or not to start the RemoteCacheManager
HotRodClientException
- if properties could not be loadedpublic RemoteCacheManager(URL config)
RemoteCacheManager(java.net.URL)
and it also starts the cache (start==true).
config
- public RemoteCacheManager(URL config, ClassLoader classLoader)
RemoteCacheManager(java.net.URL)
and it also starts the cache (start==true).
config
- Method Detail |
---|
public Properties getProperties()
Properties p = remoteCacheManager.getProperties();
// update properties
remoteCacheManager.stop();
remoteCacheManager = new RemoteCacheManager(p);
public <K,V> RemoteCache<K,V> getCache(String cacheName)
getCache
in interface BasicCacheContainer
cacheName
- name of cache to retrieve
public <K,V> RemoteCache<K,V> getCache(String cacheName, boolean forceReturnValue)
public <K,V> RemoteCache<K,V> getCache()
getCache
in interface BasicCacheContainer
public <K,V> RemoteCache<K,V> getCache(boolean forceReturnValue)
public void start()
start
in interface Lifecycle
public void stop()
stop
in interface Lifecycle
public boolean isStarted()
|
--> | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |