Package com.tangosol.net
Class CoherenceSession
java.lang.Object
com.tangosol.net.CoherenceSession
- All Implemented Interfaces:
 Session,AutoCloseable
An implementation of a 
Session allowing applications to use
 the new operator to create a Session via the default
 SessionProvider.- Author:
 - bo 2015.09.27
 - See Also:
 
- 
Nested Class Summary
Nested classes/interfaces inherited from interface com.tangosol.net.Session
Session.Option - 
Field Summary
Fields - 
Constructor Summary
ConstructorsConstructorDescriptionConstructs aCoherenceSessionusing the default session configuration.CoherenceSession(Session.Option... options) Deprecated.CoherenceSession(SessionConfiguration configuration, Coherence.Mode mode, Iterable<? extends EventInterceptor<?>> interceptors) Constructs aCoherenceSessionbased on the specifiedSessionConfiguration. - 
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Activate thisSession.voidclose()voidclose(NamedCollection col) Close and release the aNamedCollection.voiddestroy(NamedCollection col) Destroy aNamedCollection.<K,V> NamedCache <K, V> getCache(String sName, NamedMap.Option... options) <E> NamedDeque<E> Acquire aNamedDeque.<E> NamedDeque<E> getDeque(String sName, NamedCollection.Option... options) Acquire aNamedDeque.Return theInterceptorRegistryfor this session.<K,V> NamedMap <K, V> getMap(String sName, NamedMap.Option... options) getName()Return the name of this session, if available.<E> NamedQueue<E> Acquire aNamedQueue.<E> NamedQueue<E> getQueue(String sName, NamedCollection.Option... options) Acquire aNamedQueue.Return theResourceRegistryfor this session.Return the scope name of this cache factory, if available.getService(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, waitMethods inherited from interface com.tangosol.net.Session
createPublisher, createPublisher, createSubscriber, createSubscriber, getTopic 
- 
Field Details
- 
m_session
The underlyingSessionto which this implementation will delegate requests. 
 - 
 - 
Constructor Details
- 
CoherenceSession
public CoherenceSession()Constructs aCoherenceSessionusing the default session configuration.- Throws:
 IllegalStateException- if a session could not be created- See Also:
 
 - 
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.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 Details
- 
getMap
Description copied from interface:Session - 
getCache
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
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 
 - 
getQueue
Description copied from interface:SessionAcquire aNamedQueue.- Specified by:
 getQueuein interfaceSession- Type Parameters:
 E- the type of elements in theNamedQueue- Parameters:
 sName- the name of theNamedQueue- Returns:
 - a 
NamedQueue 
 - 
getQueue
Description copied from interface:SessionAcquire aNamedQueue.- Specified by:
 getQueuein interfaceSession- Type Parameters:
 E- the type of elements in theNamedQueue- Parameters:
 sName- the name of theNamedQueue- Returns:
 - a 
NamedQueue 
 - 
getDeque
Description copied from interface:SessionAcquire aNamedDeque.- Specified by:
 getDequein interfaceSession- Type Parameters:
 E- the type of elements in theNamedDeque- Parameters:
 sName- the name of theNamedDeque- Returns:
 - a 
NamedQueue 
 - 
getDeque
Description copied from interface:SessionAcquire aNamedDeque.- Specified by:
 getDequein interfaceSession- Type Parameters:
 E- the type of elements in theNamedDeque- Parameters:
 sName- the name of theNamedDeque- Returns:
 - a 
NamedQueue 
 - 
close
Description copied from interface:SessionClose and release the aNamedCollection.- Specified by:
 closein interfaceSession- Parameters:
 col- theNamedCollectionto close
 - 
destroy
Description copied from interface:SessionDestroy aNamedCollection.Warning: This method is used to completely destroy the specified collection across the cluster. All references in the entire cluster to this collection will be invalidated, the collection data will be cleared, and all internal resources will be released.
- Specified by:
 destroyin interfaceSession- Parameters:
 col- theNamedCollectionto destroy
 - 
close
- Specified by:
 closein interfaceAutoCloseable- Throws:
 Exception
 - 
getResourceRegistry
Description copied from interface:SessionReturn theResourceRegistryfor this session.- Specified by:
 getResourceRegistryin interfaceSession- Returns:
 - the ResourceRegistry for this session
 
 - 
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
Description copied from interface:SessionReturn the name of this session, if available. - 
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
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
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
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
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 
 
 - 
 
CoherenceSession(SessionConfiguration, Coherence.Mode, Iterable)