com.hazelcast.cache
Class HazelcastCachingProvider

java.lang.Object
  extended by com.hazelcast.cache.HazelcastCachingProvider
All Implemented Interfaces:
Closeable, javax.cache.spi.CachingProvider

public final class HazelcastCachingProvider
extends Object
implements javax.cache.spi.CachingProvider

This class is the Hazelcast JCache public CachingProvider implementation. This provider class acts as the commonly used entry point for the JCache SPI to register Hazelcast JCache as an eligible JCache implementation.

Main purpose of this provider implementation is to delegate to the user-selected internal CachingProvider implementation.

Hazelcast uses two internal CachingProviders depending on the environment:

Provider Type Selection:

First step is to check whether a selection exists using the system property hazelcast.jcache.provider.type with values client or server. If no selection exists, then the default behavior for selecting the internal provider type is based on which dependency found on classpath. Client and server provider classes are searched on classpath. If both CachingProvider implementations are found (client and server), the client provider has precedence. To select the server provider use the above mentioned property.

Since:
3.4

Field Summary
static String HAZELCAST_CONFIG_LOCATION
          Hazelcast config location property
static String HAZELCAST_INSTANCE_NAME
          Hazelcast instance name property
 
Constructor Summary
HazelcastCachingProvider()
           
 
Method Summary
 void close()
           
 void close(ClassLoader classLoader)
           
 void close(URI uri, ClassLoader classLoader)
           
 javax.cache.CacheManager getCacheManager()
           
 javax.cache.CacheManager getCacheManager(URI uri, ClassLoader classLoader)
           
 javax.cache.CacheManager getCacheManager(URI uri, ClassLoader classLoader, Properties properties)
           
 ClassLoader getDefaultClassLoader()
           
 Properties getDefaultProperties()
           
 URI getDefaultURI()
           
 boolean isSupported(javax.cache.configuration.OptionalFeature optionalFeature)
           
static Properties propertiesByInstanceName(String instanceName)
          Create the Properties with the provided instance name.
static Properties propertiesByLocation(String configFileLocation)
          Create the Properties with the provided config file location.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HAZELCAST_CONFIG_LOCATION

public static final String HAZELCAST_CONFIG_LOCATION
Hazelcast config location property

See Also:
Constant Field Values

HAZELCAST_INSTANCE_NAME

public static final String HAZELCAST_INSTANCE_NAME
Hazelcast instance name property

See Also:
Constant Field Values
Constructor Detail

HazelcastCachingProvider

public HazelcastCachingProvider()
Method Detail

propertiesByLocation

public static Properties propertiesByLocation(String configFileLocation)
Create the Properties with the provided config file location.

Parameters:
configFileLocation - config file location to configure
Returns:
properties instance pre-configured with the configuration location

propertiesByInstanceName

public static Properties propertiesByInstanceName(String instanceName)
Create the Properties with the provided instance name.

Parameters:
instanceName - instance name to configure
Returns:
properties instance pre-configured with the instance name

getCacheManager

public javax.cache.CacheManager getCacheManager(URI uri,
                                                ClassLoader classLoader,
                                                Properties properties)
Specified by:
getCacheManager in interface javax.cache.spi.CachingProvider

getDefaultClassLoader

public ClassLoader getDefaultClassLoader()
Specified by:
getDefaultClassLoader in interface javax.cache.spi.CachingProvider

getDefaultURI

public URI getDefaultURI()
Specified by:
getDefaultURI in interface javax.cache.spi.CachingProvider

getDefaultProperties

public Properties getDefaultProperties()
Specified by:
getDefaultProperties in interface javax.cache.spi.CachingProvider

getCacheManager

public javax.cache.CacheManager getCacheManager(URI uri,
                                                ClassLoader classLoader)
Specified by:
getCacheManager in interface javax.cache.spi.CachingProvider

getCacheManager

public javax.cache.CacheManager getCacheManager()
Specified by:
getCacheManager in interface javax.cache.spi.CachingProvider

close

public void close()
Specified by:
close in interface Closeable
Specified by:
close in interface javax.cache.spi.CachingProvider

close

public void close(ClassLoader classLoader)
Specified by:
close in interface javax.cache.spi.CachingProvider

close

public void close(URI uri,
                  ClassLoader classLoader)
Specified by:
close in interface javax.cache.spi.CachingProvider

isSupported

public boolean isSupported(javax.cache.configuration.OptionalFeature optionalFeature)
Specified by:
isSupported in interface javax.cache.spi.CachingProvider

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.