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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
protected void
configureTopology
(org.springframework.core.env.Environment environment, org.springframework.data.gemfire.support.ConnectionEndpointList connectionEndpoints, int connectionCount) protected Socket
connect
(org.springframework.data.gemfire.support.ConnectionEndpoint connectionEndpoint) protected int
countConnections
(org.springframework.data.gemfire.support.ConnectionEndpointList connectionEndpoints) protected boolean
doCachedMatch
(org.springframework.context.annotation.ConditionContext conditionContext) Caches the result of the computeddoMatch(ConditionContext)
operation.protected boolean
doMatch
(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 void
failOnStrictMatchAndNoMatches
(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.ConnectionEndpointList
getConnectionEndpoints
(org.springframework.core.env.Environment environment) protected List<org.springframework.data.gemfire.support.ConnectionEndpoint>
getDefaultConnectionEndpoints
(org.springframework.core.env.Environment environment) protected org.slf4j.Logger
protected List<org.springframework.data.gemfire.support.ConnectionEndpoint>
getPooledConnectionEndpoints
(org.springframework.core.env.Environment environment) protected Collection<org.apache.geode.cache.client.Pool>
protected String
Returns aString
containing a description of the runtime environment.static boolean
Determines whether an Apache Geode-based Cluster is available in the runtime environment.protected boolean
isConnected
(int connectionCount) protected boolean
isConnected
(Socket socket) protected boolean
isNotConnected
(int connectionCount) protected boolean
isStrictMatch
(org.springframework.context.annotation.ConditionContext conditionContext, org.springframework.core.type.AnnotatedTypeMetadata typeMetadata) protected boolean
isStrictMatchAndNoMatches
(boolean strictMatch, boolean matches) protected void
logConnectedRuntimeEnvironment
(org.slf4j.Logger logger) protected void
logConnectedRuntimeEnvironment
(org.slf4j.Logger logger, int connectionCount) protected void
logRuntimeEnvironment
(org.slf4j.Logger logger, int connectionCount) protected void
logUnconnectedRuntimeEnvironment
(org.slf4j.Logger logger) boolean
matches
(org.springframework.context.annotation.ConditionContext conditionContext, org.springframework.core.type.AnnotatedTypeMetadata typeMetadata) protected Socket
newSocket
(org.springframework.data.gemfire.support.ConnectionEndpoint connectionEndpoint) protected Socket
newSocket
(ClusterAwareConfiguration.PoolConnectionEndpoint poolConnectionEndpoint) protected org.springframework.context.annotation.ConditionContext
registerApplicationListener
(org.springframework.context.annotation.ConditionContext conditionContext) static void
reset()
Resets the state of thisCondition
to reevaluate whether an Apache Geode-based Cluster is available in the runtime environment.protected static void
Sets the state of theclusterAvailable
variable.static boolean
Determines whether theCondition
that 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 thisCondition
to reevaluate whether an Apache Geode-based Cluster is available in the runtime environment.- See Also:
-
set
Sets the state of theclusterAvailable
variable.- Parameters:
available
- state to set theclusterAvailable
variable to.- See Also:
-
wasClusterAvailabilityEvaluated
public static boolean wasClusterAvailabilityEvaluated()Determines whether theCondition
that determines whether an Apache Geode-based Cluster is available in the runtime environment has been evaluated.- Returns:
- a boolean value indicating whether the
Condition
that determines whether an Apache Geode-based Cluster is available in the runtime environment has been evaluated. - See Also:
-
getRuntimeEnvironmentName
Returns aString
containing a description of the runtime environment.- Returns:
- a
String
containing 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:
matches
in 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
- SpringConditionContext
capturing 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:
-
ConditionContext
registerApplicationListener(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
- SpringConditionContext
capturing the context in which the condition(s) are evaluated; must not be null.- Returns:
- the given
ConditionContext
. - See Also:
-
ConditionContext
doCachedMatch(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)
-