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>
CreatesSession
s for use by applications requiring Coherence-based resources, includingNamedCache
s, often for specificClassLoader
s, for deployed modules.- Author:
- bo 2015.07.27
- See Also:
Session
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
SessionProvider.Context
A context used by providers.static class
SessionProvider.DefaultContext
static interface
SessionProvider.Option
Deprecated.since 20.12 useSessionConfiguration
andcreateSession(SessionConfiguration, Coherence.Mode, Iterable)
static interface
SessionProvider.Provider
Implemented by suppliers of aSessionProvider
.static class
SessionProvider.Providers
Deprecated.since 20.12 there is no replacement for this class
-
Field Summary
Fields Modifier and Type Field Description static int
PRIORITY
The default priority for providers.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default 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)
default Optional<Session>
createSession(SessionConfiguration configuration, Coherence.Mode mode)
Create aSession
from the specified configuration.default Optional<Session>
createSession(SessionConfiguration configuration, Coherence.Mode defaultMode, Iterable<? extends EventInterceptor<?>> interceptors)
Create aSession
from the specified configuration.default Optional<Session>
createSession(SessionConfiguration configuration, Coherence.Mode defaultMode, String sScopePrefix, Iterable<? extends EventInterceptor<?>> interceptors)
Create aSession
from the specified configuration.SessionProvider.Context
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
getPriority()
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 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 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 default Session createSession(Session.Option... options)
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
default int compareTo(SessionProvider other)
- Specified by:
compareTo
in interfaceComparable<SessionProvider>
-
releaseSession
default void releaseSession(Session session)
Release theSession
.- Parameters:
session
- theSession
to release
-
get
@Deprecated static SessionProvider get(SessionProvider.Option... options)
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
static SessionProvider get()
Acquire theSessionProvider
to use to create sessions.- Returns:
- a
SessionProvider
-
-