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
-
Constructor Summary
ConstructorDescriptionConstructs aCoherenceSession
using the default session configuration.CoherenceSession
(Session.Option... options) Deprecated.CoherenceSession
(SessionConfiguration configuration, Coherence.Mode mode, Iterable<? extends EventInterceptor<?>> interceptors) Constructs aCoherenceSession
based on the specifiedSessionConfiguration
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
activate()
Activate thisSession
.void
close()
<K,
V> NamedCache <K, V> getCache
(String sName, NamedMap.Option... options) Return theInterceptorRegistry
for this session.<K,
V> NamedMap <K, V> getMap
(String sName, NamedMap.Option... options) getName()
Return the name of this session, if available.Return theResourceRegistry
for this session.Return the scope name of this cache factory, if available.getService
(String sServiceName) Returns a service for the given name ornull
if no service exists in this session with the specified name.<V> NamedTopic
<V> getTopic
(String sName, NamedCollection.Option... options) Acquire aNamedTopic
using the specifiedValueTypeAssertion
.boolean
isActive()
Returntrue
if thisSession
is active and has not been closed.boolean
isCacheActive
(String sCacheName, ClassLoader loader) Validate whether a cache with the given name is active in the context of the givenClassLoader
.boolean
isMapActive
(String sMapName, ClassLoader loader) Validate whether a map with the given name is active in the context of the givenClassLoader
.boolean
isTopicActive
(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
-
Field Details
-
m_session
The underlyingSession
to which this implementation will delegate requests.
-
-
Constructor Details
-
CoherenceSession
public CoherenceSession()Constructs aCoherenceSession
using 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 aCoherenceSession
based on the specifiedSessionConfiguration
.- Parameters:
configuration
- theSessionConfiguration
s for theCoherenceSession
mode
- the mode Coherence is running ininterceptors
- optionalinterceptors
to 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 aCoherenceSession
based on the specifiedSession.Option
s using the defaultSessionProvider
.- Parameters:
options
- theSession.Option
s 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:
getCache
in interfaceSession
- Type Parameters:
K
- the type of keys for theNamedCache
V
- the type of values for theNamedCache
- Parameters:
sName
- the name of theNamedCache
options
- theNamedMap.Option
s- Returns:
- a
NamedCache
-
getTopic
Description copied from interface:Session
Acquire aNamedTopic
using the specifiedValueTypeAssertion
.- Specified by:
getTopic
in interfaceSession
- Type Parameters:
V
- the type of elements for theNamedTopic
- Parameters:
sName
- the name of theNamedTopic
- Returns:
- a
NamedCache
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
getResourceRegistry
Description copied from interface:Session
Return theResourceRegistry
for this session.- Specified by:
getResourceRegistry
in interfaceSession
- Returns:
- the ResourceRegistry for this session
-
getInterceptorRegistry
Description copied from interface:Session
Return theInterceptorRegistry
for this session.EventInterceptor
s registered with this session will be scoped to services and caches created by this session.- Specified by:
getInterceptorRegistry
in interfaceSession
- Returns:
- the
InterceptorRegistry
for this session
-
getName
Description copied from interface:Session
Return the name of this session, if available. -
getScopeName
Description copied from interface:Session
Return the scope name of this cache factory, if available.- Specified by:
getScopeName
in interfaceSession
- Returns:
- the scope name of this cache factory, if available;
null
otherwise
-
isCacheActive
Description copied from interface:Session
Validate 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:
isCacheActive
in 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:Session
Validate 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:
isMapActive
in 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:Session
Validate 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:
isTopicActive
in 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:Session
Returntrue
if thisSession
is active and has not been closed. -
getService
Description copied from interface:Session
Returns a service for the given name ornull
if no service exists in this session with the specified name.- Specified by:
getService
in interfaceSession
- Parameters:
sServiceName
- the service name- Returns:
- the requested Service or
null
if no service exists in this session with the specified name
-
CoherenceSession(SessionConfiguration, Coherence.Mode, Iterable)