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
Creates
Session
s for use by applications requiring Coherence-based
resources, including NamedCache
s, often for specific
ClassLoader
s, for deployed modules.- Author:
- bo 2015.07.27
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
A context used by providers.static class
static interface
Deprecated.static interface
Implemented by suppliers of aSessionProvider
.static class
Deprecated.since 20.12 there is no replacement for this class -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
close()
Optionally close all of theSession
instances provided by thisSessionProvider
.default int
compareTo
(SessionProvider other) default Session
createSession
(Session.Option... options) Deprecated.since 20.12 - usecreateSession(SessionConfiguration, Coherence.Mode, Iterable)
createSession
(SessionConfiguration configuration, Coherence.Mode mode) Create aSession
from the specified configuration.createSession
(SessionConfiguration configuration, Coherence.Mode defaultMode, Iterable<? extends EventInterceptor<?>> interceptors) Create aSession
from the specified configuration.createSession
(SessionConfiguration configuration, Coherence.Mode defaultMode, String sScopePrefix, Iterable<? extends EventInterceptor<?>> interceptors) Create aSession
from the specified configuration.createSession
(SessionConfiguration configuration, SessionProvider.Context context) Create aSession
from the specified configuration.static SessionProvider
get()
Acquire theSessionProvider
to use to create sessions.static SessionProvider
get
(SessionProvider.Option... options) Deprecated.since 20.12SessionProvider.Option
is deprecated useget()
default int
Obtain the priority that thisSessionProvider
should have over otherSessionProvider
s when multiple providers may be able to provide aSession
.default void
releaseSession
(Session session) Release theSession
.
-
Field Details
-
PRIORITY
static final int PRIORITYThe default priority for providers.- See Also:
-
-
Method Details
-
createSession
Create aSession
from the specified configuration.- Parameters:
configuration
- the configuration to use to create the sessionmode
- the currentCoherence.Mode
- Returns:
- an
Optional
containing aSession
or an emptyOptional
if this provider cannot supply aSession
from the specified configuration
-
createSession
default Optional<Session> createSession(SessionConfiguration configuration, Coherence.Mode defaultMode, Iterable<? extends EventInterceptor<?>> interceptors) Create aSession
from the specified configuration.- Parameters:
configuration
- the configuration to use to create the sessiondefaultMode
- theCoherence.Mode
the session should use if not specified in theSessionConfiguration
interceptors
- optionalinterceptors
to add to the session in addition to any in the configuration- Returns:
- an
Optional
containing aSession
or an emptyOptional
if this provider cannot supply aSession
from the specified configuration
-
createSession
default Optional<Session> createSession(SessionConfiguration configuration, Coherence.Mode defaultMode, String sScopePrefix, Iterable<? extends EventInterceptor<?>> interceptors) Create aSession
from the specified configuration.- Parameters:
configuration
- the configuration to use to create the sessiondefaultMode
- theCoherence.Mode
the session should use if not specified in theSessionConfiguration
sScopePrefix
- the prefix to prepend to the session scopeinterceptors
- optionalinterceptors
to add to the session in addition to any in the configuration- Returns:
- an
Optional
containing aSession
or an emptyOptional
if this provider cannot supply aSession
from the specified configuration
-
createSession
SessionProvider.Context createSession(SessionConfiguration configuration, SessionProvider.Context context) Create aSession
from the specified configuration.The return value is a
SessionProvider.Context
that may be the same context passed in. If the provider could create aSession
the 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.Context
to use when creating the session- Returns:
- the resulting
SessionProvider.Context
either not completed, completed with aSession
or completed empty.
-
createSession
Deprecated.since 20.12 - usecreateSession(SessionConfiguration, Coherence.Mode, Iterable)
Create aSession
using the specifiedSessionProvider.Option
s.- Parameters:
options
- theSession.Option
s for creating theSession
- Returns:
- a new
Session
ornull
if this provider cannot supply aSession
from the specified options - Throws:
IllegalArgumentException
- when aSession
can't be creating using the specifiedSessionProvider.Option
.
-
getPriority
default int getPriority()Obtain the priority that thisSessionProvider
should have over otherSessionProvider
s 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 theSession
instances provided by thisSessionProvider
.This allows providers where sessions consume external resources, such as remote connections, to clean up.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<SessionProvider>
-
releaseSession
Release theSession
.- Parameters:
session
- theSession
to release
-
get
Deprecated.since 20.12SessionProvider.Option
is deprecated useget()
Acquire theSessionProvider
based on the current calling context and the providedSessionProvider.Option
s.- Parameters:
options
- theSessionProvider.Option
s for acquiring theSessionProvider
- Returns:
- a
SessionProvider
- Throws:
IllegalArgumentException
- when aSessionProvider
can't be acquired using the specifiedSessionProvider.Option
sIllegalStateException
- when aSessionProvider
can't be auto-detected
-
get
Acquire theSessionProvider
to use to create sessions.- Returns:
- a
SessionProvider
-
SessionConfiguration
andcreateSession(SessionConfiguration, Coherence.Mode, Iterable)