Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
0e8ce13c
Commit
0e8ce13c
authored
Dec 30, 2015
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy javadocs from interfaces to config property fields
parent
e4a1b50e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
417 additions
and
15 deletions
+417
-15
EurekaClientConfigBean.java
...ramework/cloud/netflix/eureka/EurekaClientConfigBean.java
+248
-14
EurekaInstanceConfigBean.java
...mework/cloud/netflix/eureka/EurekaInstanceConfigBean.java
+169
-1
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBean.java
View file @
0e8ce13c
/*
* Copyright 2013-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright 2013-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
cloud
.
netflix
.
eureka
;
...
...
@@ -58,90 +58,324 @@ public class EurekaClientConfigBean implements EurekaClientConfig, EurekaConstan
private
EurekaTransportConfig
transport
=
new
CloudEurekaTransportConfig
();
/**
* Indicates how often(in seconds) to fetch the registry information from the eureka
* server.
*/
private
int
registryFetchIntervalSeconds
=
30
;
/**
* Indicates how often(in seconds) to replicate instance changes to be replicated to
* the eureka server.
*/
private
int
instanceInfoReplicationIntervalSeconds
=
30
;
/**
* Indicates how long initially (in seconds) to replicate instance info to the eureka
* server
*/
private
int
initialInstanceInfoReplicationIntervalSeconds
=
40
;
/**
* Indicates how often(in seconds) to poll for changes to eureka server information.
* Eureka servers could be added or removed and this setting controls how soon the
* eureka clients should know about it.
*/
private
int
eurekaServiceUrlPollIntervalSeconds
=
5
*
MINUTES
;
/**
* Gets the proxy port to eureka server if any.
*/
private
String
proxyPort
;
/**
* Gets the proxy host to eureka server if any.
*/
private
String
proxyHost
;
/**
* Gets the proxy user name if any.
*/
private
String
proxyUserName
;
/**
* Gets the proxy password if any.
*/
private
String
proxyPassword
;
/**
* Indicates how long to wait (in seconds) before a read from eureka server needs to
* timeout.
*/
private
int
eurekaServerReadTimeoutSeconds
=
8
;
/**
* Indicates how long to wait (in seconds) before a connection to eureka server needs
* to timeout. Note that the connections in the client are pooled by
* org.apache.http.client.HttpClient and this setting affects the actual connection
* creation and also the wait time to get the connection from the pool.
*/
private
int
eurekaServerConnectTimeoutSeconds
=
5
;
/**
* Gets the name of the implementation which implements BackupRegistry to fetch the
* registry information as a fall back option for only the first time when the eureka
* client starts.
*
* This may be needed for applications which needs additional resiliency for registry
* information without which it cannot operate.
*/
private
String
backupRegistryImpl
;
/**
* Gets the total number of connections that is allowed from eureka client to all
* eureka servers.
*/
private
int
eurekaServerTotalConnections
=
200
;
/**
* Gets the total number of connections that is allowed from eureka client to a eureka
* server host.
*/
private
int
eurekaServerTotalConnectionsPerHost
=
50
;
/**
* Gets the URL context to be used to construct the service url to contact eureka
* server when the list of eureka servers come from the DNS. This information is not
* required if the contract returns the service urls from eurekaServerServiceUrls.
*
* The DNS mechanism is used when useDnsForFetchingServiceUrls is set to true and the
* eureka client expects the DNS to configured a certain way so that it can fetch
* changing eureka servers dynamically. The changes are effective at runtime.
*/
private
String
eurekaServerURLContext
;
/**
* Gets the port to be used to construct the service url to contact eureka server when
* the list of eureka servers come from the DNS.This information is not required if
* the contract returns the service urls eurekaServerServiceUrls(String).
*
* The DNS mechanism is used when useDnsForFetchingServiceUrls is set to true and the
* eureka client expects the DNS to configured a certain way so that it can fetch
* changing eureka servers dynamically.
*
* The changes are effective at runtime.
*/
private
String
eurekaServerPort
;
/**
* Gets the DNS name to be queried to get the list of eureka servers.This information
* is not required if the contract returns the service urls by implementing
* serviceUrls.
*
* The DNS mechanism is used when useDnsForFetchingServiceUrls is set to true and the
* eureka client expects the DNS to configured a certain way so that it can fetch
* changing eureka servers dynamically.
*
* The changes are effective at runtime.
*/
private
String
eurekaServerDNSName
;
/**
* Gets the region (used in AWS datacenters) where this instance resides.
*/
private
String
region
=
"us-east-1"
;
/**
* Indicates how much time (in seconds) that the HTTP connections to eureka server can
* stay idle before it can be closed.
*
* In the AWS environment, it is recommended that the values is 30 seconds or less,
* since the firewall cleans up the connection information after a few mins leaving
* the connection hanging in limbo
*/
private
int
eurekaConnectionIdleTimeoutSeconds
=
30
;
/**
* Indicates whether the client is only interested in the registry information for a
* single VIP.
*/
private
String
registryRefreshSingleVipAddress
;
/**
* The thread pool size for the heartbeatExecutor to initialise with
*/
private
int
heartbeatExecutorThreadPoolSize
=
2
;
/**
* Heartbeat executor exponential back off related property. It is a maximum
* multiplier value for retry delay, in case where a sequence of timeouts occurred.
*/
private
int
heartbeatExecutorExponentialBackOffBound
=
10
;
/**
* The thread pool size for the cacheRefreshExecutor to initialise with
*/
private
int
cacheRefreshExecutorThreadPoolSize
=
2
;
/**
* Cache refresh executor exponential back off related property. It is a maximum
* multiplier value for retry delay, in case where a sequence of timeouts occurred.
*/
private
int
cacheRefreshExecutorExponentialBackOffBound
=
10
;
/**
* Map of availability zone to fully qualified URLs to communicate with eureka server.
*
* Typically the eureka server URLs carry protocol,host,port,context and version
* information if any. Example:
* http://ec2-256-156-243-129.compute-1.amazonaws.com:7001/eureka/
*
* The changes are effective at runtime at the next service url refresh cycle as
* specified by eurekaServiceUrlPollIntervalSeconds.
*/
private
Map
<
String
,
String
>
serviceUrl
=
new
HashMap
<>();
{
this
.
serviceUrl
.
put
(
DEFAULT_ZONE
,
DEFAULT_URL
);
}
/**
* Indicates whether the content fetched from eureka server has to be compressed
* whenever it is supported by the server. The registry information from the eureka
* server is compressed for optimum network traffic.
*/
private
boolean
gZipContent
=
true
;
/**
* Indicates whether the eureka client should use the DNS mechanism to fetch a list of
* eureka servers to talk to. When the DNS name is updated to have additional servers,
* that information is used immediately after the eureka client polls for that
* information as specified in eurekaServiceUrlPollIntervalSeconds.
*
* Alternatively, the service urls can be returned serviceUrls, but the users should
* implement their own mechanism to return the updated list in case of changes.
*
* The changes are effective at runtime.
*/
private
boolean
useDnsForFetchingServiceUrls
=
false
;
/**
* Indicates whether or not this instance should register its information with eureka
* server for discovery by others.
*
* In some cases, you do not want your instances to be discovered whereas you just
* want do discover other instances.
*/
private
boolean
registerWithEureka
=
true
;
/**
* Indicates whether or not this instance should try to use the eureka server in the
* same zone for latency and/or other reason.
*
* Ideally eureka clients are configured to talk to servers in the same zone
*
* The changes are effective at runtime at the next registry fetch cycle as specified
* by registryFetchIntervalSeconds
*/
private
boolean
preferSameZoneEureka
=
true
;
/**
* Indicates whether to log differences between the eureka server and the eureka
* client in terms of registry information.
*
* Eureka client tries to retrieve only delta changes from eureka server to minimize
* network traffic. After receiving the deltas, eureka client reconciles the
* information from the server to verify it has not missed out some information.
* Reconciliation failures could happen when the client has had network issues
* communicating to server.If the reconciliation fails, eureka client gets the full
* registry information.
*
* While getting the full registry information, the eureka client can log the
* differences between the client and the server and this setting controls that.
*
* The changes are effective at runtime at the next registry fetch cycle as specified
* by registryFetchIntervalSecondsr
*/
private
boolean
logDeltaDiff
;
/**
* Indicates whether the eureka client should disable fetching of delta and should
* rather resort to getting the full registry information.
*
* Note that the delta fetches can reduce the traffic tremendously, because the rate
* of change with the eureka server is normally much lower than the rate of fetches.
*
* The changes are effective at runtime at the next registry fetch cycle as specified
* by registryFetchIntervalSeconds
*/
private
boolean
disableDelta
;
/**
* Comma separated list of regions for which the eureka registry information will be
* fetched. It is mandatory to define the availability zones for each of these regions
* as returned by availabilityZones. Failing to do so, will result in failure of
* discovery client startup.
*
*/
private
String
fetchRemoteRegionsRegistry
;
/**
* Gets the list of availability zones (used in AWS data centers) for the region in
* which this instance resides.
*
* The changes are effective at runtime at the next registry fetch cycle as specified
* by registryFetchIntervalSeconds.
*/
private
Map
<
String
,
String
>
availabilityZones
=
new
HashMap
<>();
/**
* Indicates whether to get the applications after filtering the applications for
* instances with only InstanceStatus UP states.
*/
private
boolean
filterOnlyUpInstances
=
true
;
/**
* Indicates whether this client should fetch eureka registry information from eureka
* server.
*/
private
boolean
fetchRegistry
=
true
;
/**
* Get a replacement string for Dollar sign <code>$</code> during
* serializing/deserializing information in eureka server.
*/
private
String
dollarReplacement
=
"_-"
;
/**
* Get a replacement string for underscore sign <code>_</code> during
* serializing/deserializing information in eureka server.
*/
private
String
escapeCharReplacement
=
"__"
;
/**
* Indicates whether server can redirect a client request to a backup server/cluster.
* If set to false, the server will handle the request directly, If set to true, it
* may send HTTP redirect to the client, with a new server location.
*/
private
boolean
allowRedirects
=
false
;
/**
* If set to true, local status updates via ApplicationInfoManager will trigger
* on-demand (but rate limited) register/updates to remote eureka servers
*/
private
boolean
onDemandUpdateStatusChange
=
true
;
/**
* This is a transient config and once the latest codecs are stable, can be removed
* (as there will only be one)
*/
private
String
encoderName
;
/**
* This is a transient config and once the latest codecs are stable, can be removed
* (as there will only be one)
*/
private
String
decoderName
;
/**
* EurekaAccept name for client data accept
*/
private
String
clientDataAccept
=
EurekaAccept
.
full
.
name
();
@Override
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBean.java
View file @
0e8ce13c
...
...
@@ -49,68 +49,236 @@ public class EurekaInstanceConfigBean implements CloudEurekaInstanceConfig {
@Setter
(
AccessLevel
.
PRIVATE
)
private
InetUtils
inetUtils
;
/**
* Get the name of the application to be registered with eureka.
*/
@Value
(
"${spring.application.name:unknown}"
)
private
String
appname
=
"unknown"
;
/**
* Get the name of the application group to be registered with eureka.
*/
private
String
appGroupName
;
/**
* Indicates whether the instance should be enabled for taking traffic as soon as it
* is registered with eureka. Sometimes the application might need to do some
* pre-processing before it is ready to take traffic.
*/
private
boolean
instanceEnabledOnit
;
/**
* Get the non-secure port on which the instance should receive traffic.
*/
private
int
nonSecurePort
=
80
;
/**
* Get the Secure port on which the instance should receive traffic.
*/
private
int
securePort
=
443
;
/**
* Indicates whether the non-secure port should be enabled for traffic or not.
*/
private
boolean
nonSecurePortEnabled
=
true
;
/**
* Indicates whether the secure port should be enabled for traffic or not.
*/
private
boolean
securePortEnabled
;
/**
* Indicates how often (in seconds) the eureka client needs to send heartbeats to
* eureka server to indicate that it is still alive. If the heartbeats are not
* received for the period specified in leaseExpirationDurationInSeconds, eureka
* server will remove the instance from its view, there by disallowing traffic to this
* instance.
*
* Note that the instance could still not take traffic if it implements
* HealthCheckCallback and then decides to make itself unavailable.
*/
private
int
leaseRenewalIntervalInSeconds
=
30
;
/**
* Indicates the time in seconds that the eureka server waits since it received the
* last heartbeat before it can remove this instance from its view and there by
* disallowing traffic to this instance.
*
* Setting this value too long could mean that the traffic could be routed to the
* instance even though the instance is not alive. Setting this value too small could
* mean, the instance may be taken out of traffic because of temporary network
* glitches.This value to be set to atleast higher than the value specified in
* leaseRenewalIntervalInSeconds.
*/
private
int
leaseExpirationDurationInSeconds
=
90
;
/**
* Gets the virtual host name defined for this instance.
*
* This is typically the way other instance would find this instance by using the
* virtual host name.Think of this as similar to the fully qualified domain name, that
* the users of your services will need to find this instance.
*/
@Value
(
"${spring.application.name:unknown}"
)
private
String
virtualHostName
;
/**
* Get the unique Id (within the scope of the appName) of this instance to be
* registered with eureka.
*/
private
String
instanceId
;
/**
* Gets the secure virtual host name defined for this instance.
*
* This is typically the way other instance would find this instance by using the
* secure virtual host name.Think of this as similar to the fully qualified domain
* name, that the users of your services will need to find this instance.
*/
private
String
secureVirtualHostName
;
/**
* Gets the AWS autoscaling group name associated with this instance. This information
* is specifically used in an AWS environment to automatically put an instance out of
* service after the instance is launched and it has been disabled for traffic..
*/
private
String
aSGName
;
/**
* Gets the metadata name/value pairs associated with this instance. This information
* is sent to eureka server and can be used by other instances.
*/
private
Map
<
String
,
String
>
metadataMap
=
new
HashMap
<>();
/**
* Returns the data center this instance is deployed. This information is used to get
* some AWS specific instance information if the instance is deployed in AWS.
*/
private
DataCenterInfo
dataCenterInfo
=
new
MyDataCenterInfo
(
DataCenterInfo
.
Name
.
MyOwn
);
/**
* Get the IPAdress of the instance. This information is for academic purposes only as
* the communication from other instances primarily happen using the information
* supplied in {@link #getHostName(boolean)}.
*/
private
String
ipAddress
;
/**
* Gets the relative status page URL path for this instance. The status page URL is
* then constructed out of the hostName and the type of communication - secure or
* unsecure as specified in securePort and nonSecurePort.
*
* It is normally used for informational purposes for other services to find about the
* status of this instance. Users can provide a simple HTML indicating what is the
* current status of the instance.
*/
private
String
statusPageUrlPath
=
"/info"
;
/**
* Gets the absolute status page URL path for this instance. The users can provide the
* statusPageUrlPath if the status page resides in the same instance talking to
* eureka, else in the cases where the instance is a proxy for some other server,
* users can provide the full URL. If the full URL is provided it takes precedence.
*
* It is normally used for informational purposes for other services to find about the
* status of this instance. Users can provide a simple HTML indicating what is the
* current status of the instance.
*/
private
String
statusPageUrl
;
/**
* Gets the relative home page URL Path for this instance. The home page URL is then
* constructed out of the hostName and the type of communication - secure or unsecure.
*
* It is normally used for informational purposes for other services to use it as a
* landing page.
*/
private
String
homePageUrlPath
=
"/"
;
/**
* Gets the absolute home page URL for this instance. The users can provide the
* homePageUrlPath if the home page resides in the same instance talking to eureka,
* else in the cases where the instance is a proxy for some other server, users can
* provide the full URL. If the full URL is provided it takes precedence.
*
* It is normally used for informational purposes for other services to use it as a
* landing page. The full URL should follow the format http://${eureka.hostname}:7001/
* where the value ${eureka.hostname} is replaced at runtime.
*/
private
String
homePageUrl
;
/**
* Gets the relative health check URL path for this instance. The health check page
* URL is then constructed out of the hostname and the type of communication - secure
* or unsecure as specified in securePort and nonSecurePort.
*
* It is normally used for making educated decisions based on the health of the
* instance - for example, it can be used to determine whether to proceed deployments
* to an entire farm or stop the deployments without causing further damage.
*/
private
String
healthCheckUrlPath
=
"/health"
;
/**
* Gets the absolute health check page URL for this instance. The users can provide
* the healthCheckUrlPath if the health check page resides in the same instance
* talking to eureka, else in the cases where the instance is a proxy for some other
* server, users can provide the full URL. If the full URL is provided it takes
* precedence.
*
* <p>
* It is normally used for making educated decisions based on the health of the
* instance - for example, it can be used to determine whether to proceed deployments
* to an entire farm or stop the deployments without causing further damage. The full
* URL should follow the format http://${eureka.hostname}:7001/ where the value
* ${eureka.hostname} is replaced at runtime.
*/
private
String
healthCheckUrl
;
/**
* Gets the absolute secure health check page URL for this instance. The users can
* provide the secureHealthCheckUrl if the health check page resides in the same
* instance talking to eureka, else in the cases where the instance is a proxy for
* some other server, users can provide the full URL. If the full URL is provided it
* takes precedence.
*
* <p>
* It is normally used for making educated decisions based on the health of the
* instance - for example, it can be used to determine whether to proceed deployments
* to an entire farm or stop the deployments without causing further damage. The full
* URL should follow the format http://${eureka.hostname}:7001/ where the value
* ${eureka.hostname} is replaced at runtime.
*/
private
String
secureHealthCheckUrl
;
/**
* Get the namespace used to find properties. Ignored in Spring Cloud.
*/
private
String
namespace
=
"eureka"
;
/**
* The hostname if it can be determined at configuration time (otherwise it will be
* guessed from OS primitives).
*/
private
String
hostname
;
/**
* Flag to say that, when guessing a hostname, the IP address of the server should be
* used in prference to the hostname reported by the OS.
*/
private
boolean
preferIpAddress
=
false
;
/**
* Initial status to register with rmeote Eureka server.
*/
private
InstanceStatus
initialStatus
=
InstanceStatus
.
UP
;
public
String
getHostname
()
{
return
getHostName
(
false
);
}
private
EurekaInstanceConfigBean
()
{}
private
EurekaInstanceConfigBean
()
{
}
public
EurekaInstanceConfigBean
(
InetUtils
inetUtils
)
{
this
.
inetUtils
=
inetUtils
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment