Package com.tangosol.net
Interface SessionProvider
-
- All Superinterfaces:
Comparable<SessionProvider>
- All Known Subinterfaces:
CacheFactoryBuilder
- All Known Implementing Classes:
DefaultCacheFactoryBuilder,com.tangosol.internal.net.DefaultSessionProvider,ScopedCacheFactoryBuilder,SessionProvider.Providers,SingletonCacheFactoryBuilder
public interface SessionProvider extends Comparable<SessionProvider>
CreatesSessions for use by applications requiring Coherence-based resources, includingNamedCaches, often for specificClassLoaders, for deployed modules.- Author:
- bo 2015.07.27
- See Also:
Session
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceSessionProvider.ContextA context used by providers.static classSessionProvider.DefaultContextstatic interfaceSessionProvider.OptionDeprecated.since 20.12 useSessionConfigurationandcreateSession(SessionConfiguration, Coherence.Mode, Iterable)static interfaceSessionProvider.ProviderImplemented by suppliers of aSessionProvider.static classSessionProvider.ProvidersDeprecated.since 20.12 there is no replacement for this class
-
Field Summary
Fields Modifier and Type Field Description static intPRIORITYThe default priority for providers.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default 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)default Optional<Session>createSession(SessionConfiguration configuration, Coherence.Mode mode)Create aSessionfrom the specified configuration.default Optional<Session>createSession(SessionConfiguration configuration, Coherence.Mode defaultMode, Iterable<? extends EventInterceptor<?>> interceptors)Create aSessionfrom the specified configuration.default Optional<Session>createSession(SessionConfiguration configuration, Coherence.Mode defaultMode, String sScopePrefix, Iterable<? extends EventInterceptor<?>> interceptors)Create aSessionfrom the specified configuration.SessionProvider.ContextcreateSession(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 intgetPriority()Obtain the priority that thisSessionProvidershould have over otherSessionProviders when multiple providers may be able to provide aSession.default voidreleaseSession(Session session)Release theSession.
-
-
-
Field Detail
-
PRIORITY
static final int PRIORITY
The default priority for providers.- See Also:
- Constant Field Values
-
-
Method Detail
-
createSession
default Optional<Session> createSession(SessionConfiguration configuration, Coherence.Mode mode)
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 default Session createSession(Session.Option... options)
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
default int compareTo(SessionProvider other)
- Specified by:
compareToin interfaceComparable<SessionProvider>
-
releaseSession
default void releaseSession(Session session)
Release theSession.- Parameters:
session- theSessionto release
-
get
@Deprecated static SessionProvider get(SessionProvider.Option... options)
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
static SessionProvider get()
Acquire theSessionProviderto use to create sessions.- Returns:
- a
SessionProvider
-
-