Class ClusterAwareConfiguration.ClusterAwareCondition
java.lang.Object
org.springframework.geode.config.annotation.ClusterAwareConfiguration.ClusterAwareCondition
- All Implemented Interfaces:
org.springframework.context.annotation.Condition
- Direct Known Subclasses:
ClusterAvailableConfiguration.AbstractCloudPlatformAvailableCondition,ClusterAvailableConfiguration.StandaloneClusterAvailableCondition,ClusterNotAvailableConfiguration.ClusterNotAvailableCondition
- Enclosing class:
- ClusterAwareConfiguration
public static class ClusterAwareConfiguration.ClusterAwareCondition
extends Object
implements org.springframework.context.annotation.Condition
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanprotected voidconfigureTopology(org.springframework.core.env.Environment environment, org.springframework.data.gemfire.support.ConnectionEndpointList connectionEndpoints, int connectionCount) protected Socketconnect(org.springframework.data.gemfire.support.ConnectionEndpoint connectionEndpoint) protected intcountConnections(org.springframework.data.gemfire.support.ConnectionEndpointList connectionEndpoints) protected booleandoCachedMatch(org.springframework.context.annotation.ConditionContext conditionContext) Caches the result of the computeddoMatch(ConditionContext)operation.protected booleandoMatch(org.springframework.context.annotation.ConditionContext conditionContext) Performs the actual conditional match to determine whether this Spring Boot for Apache Geode application can connect to an available Apache Geode cluster available in any environment (e.g.protected voidfailOnStrictMatchAndNoMatches(boolean strictMatch, boolean matches) protected List<org.springframework.data.gemfire.support.ConnectionEndpoint>getConfiguredConnectionEndpoints(org.springframework.core.env.Environment environment) protected org.springframework.data.gemfire.support.ConnectionEndpointListgetConnectionEndpoints(org.springframework.core.env.Environment environment) protected List<org.springframework.data.gemfire.support.ConnectionEndpoint>getDefaultConnectionEndpoints(org.springframework.core.env.Environment environment) protected org.slf4j.Loggerprotected List<org.springframework.data.gemfire.support.ConnectionEndpoint>getPooledConnectionEndpoints(org.springframework.core.env.Environment environment) protected Collection<org.apache.geode.cache.client.Pool>protected StringReturns aStringcontaining a description of the runtime environment.static booleanDetermines whether an Apache Geode-based Cluster is available in the runtime environment.protected booleanisConnected(int connectionCount) protected booleanisConnected(Socket socket) protected booleanisNotConnected(int connectionCount) protected booleanisStrictMatch(org.springframework.context.annotation.ConditionContext conditionContext, org.springframework.core.type.AnnotatedTypeMetadata typeMetadata) protected booleanisStrictMatchAndNoMatches(boolean strictMatch, boolean matches) protected voidlogConnectedRuntimeEnvironment(org.slf4j.Logger logger) protected voidlogConnectedRuntimeEnvironment(org.slf4j.Logger logger, int connectionCount) protected voidlogRuntimeEnvironment(org.slf4j.Logger logger, int connectionCount) protected voidlogUnconnectedRuntimeEnvironment(org.slf4j.Logger logger) booleanmatches(org.springframework.context.annotation.ConditionContext conditionContext, org.springframework.core.type.AnnotatedTypeMetadata typeMetadata) protected SocketnewSocket(org.springframework.data.gemfire.support.ConnectionEndpoint connectionEndpoint) protected SocketnewSocket(ClusterAwareConfiguration.PoolConnectionEndpoint poolConnectionEndpoint) protected org.springframework.context.annotation.ConditionContextregisterApplicationListener(org.springframework.context.annotation.ConditionContext conditionContext) static voidreset()Resets the state of thisConditionto reevaluate whether an Apache Geode-based Cluster is available in the runtime environment.protected static voidSets the state of theclusterAvailablevariable.static booleanDetermines whether theConditionthat determines whether an Apache Geode-based Cluster is available in the runtime environment has been evaluated.
-
Field Details
-
RUNTIME_ENVIRONMENT_NAME
- See Also:
-
-
Constructor Details
-
ClusterAwareCondition
public ClusterAwareCondition()
-
-
Method Details
-
isAvailable
public static boolean isAvailable()Determines whether an Apache Geode-based Cluster is available in the runtime environment.- Returns:
- a boolean value indicating whether an Apache Geode-based Cluster is available in the runtime environment.
- See Also:
-
reset
public static void reset()Resets the state of thisConditionto reevaluate whether an Apache Geode-based Cluster is available in the runtime environment.- See Also:
-
set
Sets the state of theclusterAvailablevariable.- Parameters:
available- state to set theclusterAvailablevariable to.- See Also:
-
wasClusterAvailabilityEvaluated
public static boolean wasClusterAvailabilityEvaluated()Determines whether theConditionthat determines whether an Apache Geode-based Cluster is available in the runtime environment has been evaluated.- Returns:
- a boolean value indicating whether the
Conditionthat determines whether an Apache Geode-based Cluster is available in the runtime environment has been evaluated. - See Also:
-
getRuntimeEnvironmentName
Returns aStringcontaining a description of the runtime environment.- Returns:
- a
Stringcontaining a description of the runtime environment.
-
matches
public boolean matches(@NonNull org.springframework.context.annotation.ConditionContext conditionContext, @NonNull org.springframework.core.type.AnnotatedTypeMetadata typeMetadata) - Specified by:
matchesin interfaceorg.springframework.context.annotation.Condition
-
isStrictMatch
protected boolean isStrictMatch(@NonNull org.springframework.context.annotation.ConditionContext conditionContext, @NonNull org.springframework.core.type.AnnotatedTypeMetadata typeMetadata) -
isStrictMatchAndNoMatches
protected boolean isStrictMatchAndNoMatches(boolean strictMatch, boolean matches) -
failOnStrictMatchAndNoMatches
protected void failOnStrictMatchAndNoMatches(boolean strictMatch, boolean matches) -
doCachedMatch
protected boolean doCachedMatch(@NonNull org.springframework.context.annotation.ConditionContext conditionContext) Caches the result of the computeddoMatch(ConditionContext)operation. Subsequent calls returns the cached value of the computed (once)doMatch(ConditionContext)operation.- Parameters:
conditionContext- SpringConditionContextcapturing the context in which the conditions are evaluated; must not be null.- Returns:
- a boolean value indicating whether the conditions match (i.e. true).
- See Also:
-
ConditionContextregisterApplicationListener(ConditionContext)doMatch(ConditionContext)
-
registerApplicationListener
@NonNull protected org.springframework.context.annotation.ConditionContext registerApplicationListener(@NonNull org.springframework.context.annotation.ConditionContext conditionContext) -
doMatch
protected boolean doMatch(@NonNull org.springframework.context.annotation.ConditionContext conditionContext) Performs the actual conditional match to determine whether this Spring Boot for Apache Geode application can connect to an available Apache Geode cluster available in any environment (e.g. Standalone or Cloud).- Parameters:
conditionContext- SpringConditionContextcapturing the context in which the condition(s) are evaluated; must not be null.- Returns:
- the given
ConditionContext. - See Also:
-
ConditionContextdoCachedMatch(ConditionContext)getConnectionEndpoints(Environment)countConnections(ConnectionEndpointList)configureTopology(Environment, ConnectionEndpointList, int)logRuntimeEnvironment(Logger, int)isMatch(ConnectionEndpointList, int)
-
getLogger
@NonNull protected org.slf4j.Logger getLogger() -
getConnectionEndpoints
protected org.springframework.data.gemfire.support.ConnectionEndpointList getConnectionEndpoints(@NonNull org.springframework.core.env.Environment environment) -
getDefaultConnectionEndpoints
protected List<org.springframework.data.gemfire.support.ConnectionEndpoint> getDefaultConnectionEndpoints(@NonNull org.springframework.core.env.Environment environment) -
getConfiguredConnectionEndpoints
protected List<org.springframework.data.gemfire.support.ConnectionEndpoint> getConfiguredConnectionEndpoints(@NonNull org.springframework.core.env.Environment environment) -
getPooledConnectionEndpoints
protected List<org.springframework.data.gemfire.support.ConnectionEndpoint> getPooledConnectionEndpoints(@NonNull org.springframework.core.env.Environment environment) -
getPoolsFromApacheGeode
-
countConnections
protected int countConnections(@NonNull org.springframework.data.gemfire.support.ConnectionEndpointList connectionEndpoints) -
isConnected
-
connect
@NonNull protected Socket connect(@NonNull org.springframework.data.gemfire.support.ConnectionEndpoint connectionEndpoint) throws IOException - Throws:
IOException
-
newSocket
@NonNull protected Socket newSocket(@NonNull org.springframework.data.gemfire.support.ConnectionEndpoint connectionEndpoint) throws IOException - Throws:
IOException
-
newSocket
@NonNull protected Socket newSocket(@NonNull ClusterAwareConfiguration.PoolConnectionEndpoint poolConnectionEndpoint) -
close
-
isConnected
protected boolean isConnected(int connectionCount) -
isNotConnected
protected boolean isNotConnected(int connectionCount) -
configureTopology
protected void configureTopology(@NonNull org.springframework.core.env.Environment environment, @NonNull org.springframework.data.gemfire.support.ConnectionEndpointList connectionEndpoints, int connectionCount) -
logConnectedRuntimeEnvironment
protected void logConnectedRuntimeEnvironment(@NonNull org.slf4j.Logger logger) -
logConnectedRuntimeEnvironment
protected void logConnectedRuntimeEnvironment(@NonNull org.slf4j.Logger logger, int connectionCount) -
logRuntimeEnvironment
protected void logRuntimeEnvironment(@NonNull org.slf4j.Logger logger, int connectionCount) -
logUnconnectedRuntimeEnvironment
protected void logUnconnectedRuntimeEnvironment(@NonNull org.slf4j.Logger logger)
-