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 theCoherenceConfigurer
interface.- Since:
- 3.0
- Author:
- Gunnar Hillert
-
-
Constructor Summary
Constructors Constructor Description DefaultCoherenceConfigurer(ConfigurableApplicationContext context, CoherenceEventListenerCandidates coherenceEventListenerCandidates)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.tangosol.net.Coherence
createCoherence(Set<SessionType> detectedSessionTypes)
Creates aCoherence
instance with theCoherenceConfiguration
provided bygetCoherenceConfiguration()
.protected com.tangosol.net.CoherenceConfiguration
createCoherenceConfiguration()
Create theCoherenceConfiguration
.protected CoherenceServer
createCoherenceServer()
Create aCoherenceServer
using the providedCoherence
instance.com.tangosol.net.Coherence
getCoherence()
Responsible for returning theCoherence
instance.com.tangosol.net.CoherenceConfiguration
getCoherenceConfiguration()
Responsible for creating theCoherenceConfiguration
for theCoherenceServer
.CoherenceInstanceType
getCoherenceInstanceType()
Return the configuredCoherenceInstanceType
.CoherenceServer
getCoherenceServer()
Returns theCoherenceServer
instance.Duration
getCoherenceServerStartupTimeout()
Return the Coherence Server startup timeout value.void
initialize()
void
setCoherenceInstanceType(CoherenceInstanceType coherenceInstanceType)
Set the Coherence instance type explicitly.void
setCoherenceServerStartupTimeout(Duration coherenceServerStartupTimeout)
Set the Coherence Server startup timeout value.
-
-
-
Constructor Detail
-
DefaultCoherenceConfigurer
public DefaultCoherenceConfigurer(ConfigurableApplicationContext context, CoherenceEventListenerCandidates coherenceEventListenerCandidates)
-
-
Method Detail
-
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
public CoherenceServer 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
protected com.tangosol.net.Coherence createCoherence(Set<SessionType> detectedSessionTypes)
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
protected CoherenceServer 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
public Duration getCoherenceServerStartupTimeout()
Return the Coherence Server startup timeout value.- Returns:
- may be null
-
setCoherenceServerStartupTimeout
public void setCoherenceServerStartupTimeout(Duration coherenceServerStartupTimeout)
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:
CoherenceServer
-
setCoherenceInstanceType
public void setCoherenceInstanceType(CoherenceInstanceType coherenceInstanceType)
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
public CoherenceInstanceType getCoherenceInstanceType()
Return the configuredCoherenceInstanceType
.- Returns:
- value may be null
-
-