Package com.tangosol.net
Interface SessionProvider
- All Superinterfaces:
Comparable<SessionProvider>
- All Known Subinterfaces:
CacheFactoryBuilder
- All Known Implementing Classes:
ContainerAdapter.ContainerCacheFactoryBuilder,DefaultCacheFactoryBuilder,com.tangosol.internal.net.DefaultSessionProvider,ScopedCacheFactoryBuilder,SessionProvider.Providers,SingletonCacheFactoryBuilder
Creates
Sessions for use by applications requiring Coherence-based
resources, including NamedCaches, often for specific
ClassLoaders, for deployed modules.- Author:
- bo 2015.07.27
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA context used by providers.static classstatic interfaceDeprecated.static interfaceImplemented by suppliers of aSessionProvider.static classDeprecated.since 20.12 there is no replacement for this class -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Optionally close all of theSessioninstances provided by thisSessionProvider.default intcompareTo(SessionProvider other) default SessioncreateSession(Session.Option... options) Deprecated.since 20.12 - usecreateSession(SessionConfiguration, Coherence.Mode, Iterable)createSession(SessionConfiguration configuration, Coherence.Mode mode) Create aSessionfrom the specified configuration.createSession(SessionConfiguration configuration, Coherence.Mode defaultMode, Iterable<? extends EventInterceptor<?>> interceptors) Create aSessionfrom the specified configuration.createSession(SessionConfiguration configuration, Coherence.Mode defaultMode, String sScopePrefix, Iterable<? extends EventInterceptor<?>> interceptors) Create aSessionfrom the specified configuration.createSession(SessionConfiguration configuration, SessionProvider.Context context) Create aSessionfrom the specified configuration.static SessionProviderget()Acquire theSessionProviderto use to create sessions.static SessionProviderget(SessionProvider.Option... options) Deprecated.since 20.12SessionProvider.Optionis deprecated useget()default intObtain the priority that thisSessionProvidershould have over otherSessionProviders when multiple providers may be able to provide aSession.default voidreleaseSession(Session session) Release theSession.
-
Field Details
-
PRIORITY
static final int PRIORITYThe default priority for providers.- See Also:
-
-
Method Details
-
createSession
Create aSessionfrom the specified configuration.- Parameters:
configuration- the configuration to use to create the sessionmode- the currentCoherence.Mode- Returns:
- an
Optionalcontaining aSessionor an emptyOptionalif this provider cannot supply aSessionfrom the specified configuration
-
createSession
default Optional<Session> createSession(SessionConfiguration configuration, Coherence.Mode defaultMode, Iterable<? extends EventInterceptor<?>> interceptors) Create aSessionfrom the specified configuration.- Parameters:
configuration- the configuration to use to create the sessiondefaultMode- theCoherence.Modethe session should use if not specified in theSessionConfigurationinterceptors- optionalinterceptorsto add to the session in addition to any in the configuration- Returns:
- an
Optionalcontaining aSessionor an emptyOptionalif this provider cannot supply aSessionfrom the specified configuration
-
createSession
default Optional<Session> createSession(SessionConfiguration configuration, Coherence.Mode defaultMode, String sScopePrefix, Iterable<? extends EventInterceptor<?>> interceptors) Create aSessionfrom the specified configuration.- Parameters:
configuration- the configuration to use to create the sessiondefaultMode- theCoherence.Modethe session should use if not specified in theSessionConfigurationsScopePrefix- the prefix to prepend to the session scopeinterceptors- optionalinterceptorsto add to the session in addition to any in the configuration- Returns:
- an
Optionalcontaining aSessionor an emptyOptionalif this provider cannot supply aSessionfrom the specified configuration
-
createSession
SessionProvider.Context createSession(SessionConfiguration configuration, SessionProvider.Context context) Create aSessionfrom the specified configuration.The return value is a
SessionProvider.Contextthat may be the same context passed in. If the provider could create aSessionthe context will be completed and contain a session. If the provider cannot create a session the context will not be completed. If the provider could not create a session and no other providers should be tried then the result context will be completed without a session.- Parameters:
configuration- the configuration to use to create the sessioncontext- theSessionProvider.Contextto use when creating the session- Returns:
- the resulting
SessionProvider.Contexteither not completed, completed with aSessionor completed empty.
-
createSession
Deprecated.since 20.12 - usecreateSession(SessionConfiguration, Coherence.Mode, Iterable)Create aSessionusing the specifiedSessionProvider.Options.- Parameters:
options- theSession.Options for creating theSession- Returns:
- a new
Sessionornullif this provider cannot supply aSessionfrom the specified options - Throws:
IllegalArgumentException- when aSessioncan't be creating using the specifiedSessionProvider.Option.
-
getPriority
default int getPriority()Obtain the priority that thisSessionProvidershould have over otherSessionProviders when multiple providers may be able to provide aSession.Higher values are higher precedence.
- Returns:
- this
SessionProvider's priority.
-
close
default void close()Optionally close all of theSessioninstances provided by thisSessionProvider.This allows providers where sessions consume external resources, such as remote connections, to clean up.
-
compareTo
- Specified by:
compareToin interfaceComparable<SessionProvider>
-
releaseSession
Release theSession.- Parameters:
session- theSessionto release
-
get
Deprecated.since 20.12SessionProvider.Optionis deprecated useget()Acquire theSessionProviderbased on the current calling context and the providedSessionProvider.Options.- Parameters:
options- theSessionProvider.Options for acquiring theSessionProvider- Returns:
- a
SessionProvider - Throws:
IllegalArgumentException- when aSessionProvidercan't be acquired using the specifiedSessionProvider.OptionsIllegalStateException- when aSessionProvidercan't be auto-detected
-
get
Acquire theSessionProviderto use to create sessions.- Returns:
- a
SessionProvider
-
SessionConfigurationandcreateSession(SessionConfiguration, Coherence.Mode, Iterable)