Package com.tangosol.net
Class CoherenceSession
- java.lang.Object
 - 
- com.tangosol.net.CoherenceSession
 
 
- 
- All Implemented Interfaces:
 Session,AutoCloseable
public class CoherenceSession extends Object implements Session
An implementation of aSessionallowing applications to use the new operator to create aSessionvia the defaultSessionProvider.- Author:
 - bo 2015.09.27
 - See Also:
 Session,SessionProvider
 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from interface com.tangosol.net.Session
Session.Option 
 - 
 
- 
Constructor Summary
Constructors Constructor Description CoherenceSession()Constructs aCoherenceSessionusing the default session configuration.CoherenceSession(Session.Option... options)Deprecated.since 20.12 useCoherenceSession(SessionConfiguration, Coherence.Mode, Iterable)CoherenceSession(SessionConfiguration configuration, Coherence.Mode mode, Iterable<? extends EventInterceptor<?>> interceptors)Constructs aCoherenceSessionbased on the specifiedSessionConfiguration. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate()Activate thisSession.voidclose()<K,V>
NamedCache<K,V>getCache(String sName, NamedMap.Option... options)InterceptorRegistrygetInterceptorRegistry()Return theInterceptorRegistryfor this session.<K,V>
NamedMap<K,V>getMap(String sName, NamedMap.Option... options)StringgetName()Return the name of this session, if available.ResourceRegistrygetResourceRegistry()Return theResourceRegistryfor this session.StringgetScopeName()Return the scope name of this cache factory, if available.ServicegetService(String sServiceName)Returns a service for the given name ornullif no service exists in this session with the specified name.<V> NamedTopic<V>getTopic(String sName, NamedCollection.Option... options)Acquire aNamedTopicusing the specifiedValueTypeAssertion.booleanisActive()Returntrueif thisSessionis active and has not been closed.booleanisCacheActive(String sCacheName, ClassLoader loader)Validate whether a cache with the given name is active in the context of the givenClassLoader.booleanisMapActive(String sMapName, ClassLoader loader)Validate whether a map with the given name is active in the context of the givenClassLoader.booleanisTopicActive(String sTopicName, ClassLoader loader)Validate whether a topic with the given name is active in the context of the givenClassLoader.- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface com.tangosol.net.Session
createPublisher, createPublisher, createSubscriber, createSubscriber, getTopic 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
CoherenceSession
public CoherenceSession()
Constructs aCoherenceSessionusing the default session configuration.- Throws:
 IllegalStateException- if a session could not be created- See Also:
 SessionConfiguration.defaultSession()
 
- 
CoherenceSession
public CoherenceSession(SessionConfiguration configuration, Coherence.Mode mode, Iterable<? extends EventInterceptor<?>> interceptors)
Constructs aCoherenceSessionbased on the specifiedSessionConfiguration.- Parameters:
 configuration- theSessionConfigurations for theCoherenceSessionmode- the mode Coherence is running ininterceptors- optionalinterceptorsto add to the session in addition to any in the configuration- Throws:
 IllegalStateException- if a session could not be created
 
- 
CoherenceSession
@Deprecated public CoherenceSession(Session.Option... options)
Deprecated.since 20.12 useCoherenceSession(SessionConfiguration, Coherence.Mode, Iterable)Constructs aCoherenceSessionbased on the specifiedSession.Options using the defaultSessionProvider.- Parameters:
 options- theSession.Options for theCoherenceSession- Throws:
 IllegalStateException- if a session could not be created
 
 - 
 
- 
Method Detail
- 
getMap
public <K,V> NamedMap<K,V> getMap(String sName, NamedMap.Option... options)
Description copied from interface:Session 
- 
getCache
public <K,V> NamedCache<K,V> getCache(String sName, NamedMap.Option... options)
Description copied from interface:Session- Specified by:
 getCachein interfaceSession- Type Parameters:
 K- the type of keys for theNamedCacheV- the type of values for theNamedCache- Parameters:
 sName- the name of theNamedCacheoptions- theNamedMap.Options- Returns:
 - a 
NamedCache 
 
- 
getTopic
public <V> NamedTopic<V> getTopic(String sName, NamedCollection.Option... options)
Description copied from interface:SessionAcquire aNamedTopicusing the specifiedValueTypeAssertion.- Specified by:
 getTopicin interfaceSession- Type Parameters:
 V- the type of elements for theNamedTopic- Parameters:
 sName- the name of theNamedTopic- Returns:
 - a 
NamedCache 
 
- 
close
public void close() throws Exception- Specified by:
 closein interfaceAutoCloseable- Throws:
 Exception
 
- 
getResourceRegistry
public ResourceRegistry getResourceRegistry()
Description copied from interface:SessionReturn theResourceRegistryfor this session.- Specified by:
 getResourceRegistryin interfaceSession- Returns:
 - the ResourceRegistry for this session
 
 
- 
getInterceptorRegistry
public InterceptorRegistry getInterceptorRegistry()
Description copied from interface:SessionReturn theInterceptorRegistryfor this session.EventInterceptors registered with this session will be scoped to services and caches created by this session.- Specified by:
 getInterceptorRegistryin interfaceSession- Returns:
 - the 
InterceptorRegistryfor this session 
 
- 
getName
public String getName()
Description copied from interface:SessionReturn the name of this session, if available. 
- 
getScopeName
public String getScopeName()
Description copied from interface:SessionReturn the scope name of this cache factory, if available.- Specified by:
 getScopeNamein interfaceSession- Returns:
 - the scope name of this cache factory, if available; 
nullotherwise 
 
- 
isCacheActive
public boolean isCacheActive(String sCacheName, ClassLoader loader)
Description copied from interface:SessionValidate whether a cache with the given name is active in the context of the givenClassLoader. The ClassLoader should be the same as provided to a previous call toSession.getCache(String, NamedCache.Option...).- Specified by:
 isCacheActivein interfaceSession- Parameters:
 sCacheName- the cache nameloader- the ClassLoader used to originally obtain the cache- Returns:
 - true if cache is active in context of the provided ClassLoader
 
 
- 
isMapActive
public boolean isMapActive(String sMapName, ClassLoader loader)
Description copied from interface:SessionValidate whether a map with the given name is active in the context of the givenClassLoader. The ClassLoader should be the same as provided to a previous call toSession.getMap(String, NamedMap.Option...).- Specified by:
 isMapActivein interfaceSession- Parameters:
 sMapName- the map nameloader- the ClassLoader used to originally obtain the map- Returns:
 - true if map is active in context of the provided ClassLoader
 
 
- 
isTopicActive
public boolean isTopicActive(String sTopicName, ClassLoader loader)
Description copied from interface:SessionValidate whether a topic with the given name is active in the context of the givenClassLoader. The ClassLoader should be the same as provided to a previous call toSession.getTopic(String, NamedTopic.Option...).- Specified by:
 isTopicActivein interfaceSession- Parameters:
 sTopicName- the cache nameloader- the ClassLoader used to originally obtain the topic- Returns:
 - true if topic is active in context of the provided ClassLoader
 
 
- 
activate
public void activate()
Description copied from interface:Session 
- 
isActive
public boolean isActive()
Description copied from interface:SessionReturntrueif thisSessionis active and has not been closed. 
- 
getService
public Service getService(String sServiceName)
Description copied from interface:SessionReturns a service for the given name ornullif no service exists in this session with the specified name.- Specified by:
 getServicein interfaceSession- Parameters:
 sServiceName- the service name- Returns:
 - the requested Service or 
nullif no service exists in this session with the specified name 
 
 - 
 
 -