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 theCoherenceConfigurerinterface.- 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.CoherencecreateCoherence(Set<SessionType> detectedSessionTypes)Creates aCoherenceinstance with theCoherenceConfigurationprovided bygetCoherenceConfiguration().protected com.tangosol.net.CoherenceConfigurationcreateCoherenceConfiguration()Create theCoherenceConfiguration.protected CoherenceServercreateCoherenceServer()Create aCoherenceServerusing the providedCoherenceinstance.com.tangosol.net.CoherencegetCoherence()Responsible for returning theCoherenceinstance.com.tangosol.net.CoherenceConfigurationgetCoherenceConfiguration()Responsible for creating theCoherenceConfigurationfor theCoherenceServer.CoherenceInstanceTypegetCoherenceInstanceType()Return the configuredCoherenceInstanceType.CoherenceServergetCoherenceServer()Returns theCoherenceServerinstance.DurationgetCoherenceServerStartupTimeout()Return the Coherence Server startup timeout value.voidinitialize()voidsetCoherenceInstanceType(CoherenceInstanceType coherenceInstanceType)Set the Coherence instance type explicitly.voidsetCoherenceServerStartupTimeout(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:CoherenceConfigurerResponsible for returning theCoherenceinstance.- Specified by:
getCoherencein interfaceCoherenceConfigurer- Returns:
- the Coherence instance
-
getCoherenceServer
public CoherenceServer getCoherenceServer()
Description copied from interface:CoherenceConfigurerReturns theCoherenceServerinstance. Use theCoherenceServerto start and stop theCoherenceinstance.- Specified by:
getCoherenceServerin interfaceCoherenceConfigurer- Returns:
- the Coherence Server
-
getCoherenceConfiguration
public com.tangosol.net.CoherenceConfiguration getCoherenceConfiguration()
Description copied from interface:CoherenceConfigurerResponsible for creating theCoherenceConfigurationfor theCoherenceServer.- Specified by:
getCoherenceConfigurationin 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 aCoherenceinstance with theCoherenceConfigurationprovided 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
Setof detectedSessionTypes. As soon asSessionType.SERVERis provided, the Coherence instance is configured usingCoherence.clusterMember(CoherenceConfiguration). - If the
Setof detectedSessionTypeis 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 aCoherenceServerusing the providedCoherenceinstance. IfgetCoherenceServerStartupTimeout()is not null, also provide it to theCoherenceServer. IfgetCoherenceServerStartupTimeout()is null, theCoherenceServerwill 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 theCoherenceServerwill 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, theCoherenceInstanceTypewill be defined depending on the configured CoherenceSessions. SeecreateCoherence(Set)for further details.- Parameters:
coherenceInstanceType- explicitly set the CoherenceInstanceType
-
getCoherenceInstanceType
public CoherenceInstanceType getCoherenceInstanceType()
Return the configuredCoherenceInstanceType.- Returns:
- value may be null
-
-