Class DefaultCoherenceConfigurer
java.lang.Object
com.oracle.coherence.spring.configuration.DefaultCoherenceConfigurer
- All Implemented Interfaces:
CoherenceConfigurer
@Configuration
public class DefaultCoherenceConfigurer
extends Object
implements CoherenceConfigurer
Default implementation of the
CoherenceConfigurer
interface.- Since:
- 3.0
- Author:
- Gunnar Hillert
-
Constructor Summary
ConstructorDescriptionDefaultCoherenceConfigurer
(ConfigurableApplicationContext context, CoherenceEventListenerCandidates coherenceEventListenerCandidates) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.tangosol.net.Coherence
createCoherence
(Set<SessionType> detectedSessionTypes) Creates aCoherence
instance with theCoherenceConfiguration
provided bygetCoherenceConfiguration()
.protected com.tangosol.net.CoherenceConfiguration
Create theCoherenceConfiguration
.protected CoherenceServer
Create aCoherenceServer
using the providedCoherence
instance.com.tangosol.net.Coherence
Responsible for returning theCoherence
instance.com.tangosol.net.CoherenceConfiguration
Responsible for creating theCoherenceConfiguration
for theCoherenceServer
.Return the configuredCoherenceInstanceType
.Returns theCoherenceServer
instance.Return the Coherence Server startup timeout value.void
void
setCoherenceInstanceType
(CoherenceInstanceType coherenceInstanceType) Set the Coherence instance type explicitly.void
setCoherenceServerStartupTimeout
(Duration coherenceServerStartupTimeout) Set the Coherence Server startup timeout value.
-
Constructor Details
-
DefaultCoherenceConfigurer
public DefaultCoherenceConfigurer(ConfigurableApplicationContext context, CoherenceEventListenerCandidates coherenceEventListenerCandidates)
-
-
Method Details
-
getCoherence
public com.tangosol.net.Coherence getCoherence()Description copied from interface:CoherenceConfigurer
Responsible for returning theCoherence
instance.- Specified by:
getCoherence
in interfaceCoherenceConfigurer
- Returns:
- the Coherence instance
-
getCoherenceServer
Description copied from interface:CoherenceConfigurer
Returns theCoherenceServer
instance. Use theCoherenceServer
to start and stop theCoherence
instance.- Specified by:
getCoherenceServer
in interfaceCoherenceConfigurer
- Returns:
- the Coherence Server
-
getCoherenceConfiguration
public com.tangosol.net.CoherenceConfiguration getCoherenceConfiguration()Description copied from interface:CoherenceConfigurer
Responsible for creating theCoherenceConfiguration
for theCoherenceServer
.- Specified by:
getCoherenceConfiguration
in interfaceCoherenceConfigurer
- Returns:
- the configuration for a Coherence instance
-
initialize
@PostConstruct public void initialize() -
createCoherenceConfiguration
protected com.tangosol.net.CoherenceConfiguration createCoherenceConfiguration()Create theCoherenceConfiguration
.- Returns:
- the Configuration for a Coherence instance.
-
createCoherence
Creates aCoherence
instance with theCoherenceConfiguration
provided bygetCoherenceConfiguration()
. The created Coherence instance may either be a client Coherence instance (Coherence.client(CoherenceConfiguration)
) or a cluster member instance (Coherence.clusterMember(CoherenceConfiguration)
.The rules for determining the instance type are as follows in descending priority:
- Explicit configuration via
getCoherenceInstanceType()
. - Via the
Set
of detectedSessionType
s. As soon asSessionType.SERVER
is provided, the Coherence instance is configured usingCoherence.clusterMember(CoherenceConfiguration)
. - If the
Set
of detectedSessionType
is empty, the Coherence instances is configured usingCoherence.clusterMember(CoherenceConfiguration)
.
- Parameters:
detectedSessionTypes
- must not be null- Returns:
- the Coherence instance
- Explicit configuration via
-
createCoherenceServer
Create aCoherenceServer
using the providedCoherence
instance. IfgetCoherenceServerStartupTimeout()
is not null, also provide it to theCoherenceServer
. IfgetCoherenceServerStartupTimeout()
is null, theCoherenceServer
will use the timout specified byCoherenceServer.DEFAULT_STARTUP_TIMEOUT_MILLIS
.- Returns:
- the created CoherenceServer, never null
-
getCoherenceServerStartupTimeout
Return the Coherence Server startup timeout value.- Returns:
- may be null
-
setCoherenceServerStartupTimeout
Set the Coherence Server startup timeout value. This is an optional property. If not specified theCoherenceServer
will useCoherenceServer.DEFAULT_STARTUP_TIMEOUT_MILLIS
.- Parameters:
coherenceServerStartupTimeout
- must be a positive value- See Also:
-
setCoherenceInstanceType
Set the Coherence instance type explicitly. This is an optional property. If not specified, theCoherenceInstanceType
will be defined depending on the configured CoherenceSession
s. SeecreateCoherence(Set)
for further details.- Parameters:
coherenceInstanceType
- explicitly set the CoherenceInstanceType
-
getCoherenceInstanceType
Return the configuredCoherenceInstanceType
.- Returns:
- value may be null
-