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
0f85b5ac
Commit
0f85b5ac
authored
Jul 14, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Eureka server configuration
parent
38cc8a76
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
313 additions
and
3 deletions
+313
-3
pom.xml
pom.xml
+10
-0
pom.xml
spring-platform-netflix-core/pom.xml
+15
-3
EurekaServerAutoConfiguration.java
...latform/netflix/eureka/EurekaServerAutoConfiguration.java
+104
-0
EurekaServerConfigBean.java
...ework/platform/netflix/eureka/EurekaServerConfigBean.java
+182
-0
spring.factories
...netflix-core/src/main/resources/META-INF/spring.factories
+2
-0
No files found.
pom.xml
View file @
0f85b5ac
...
...
@@ -27,6 +27,11 @@
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.platform
</groupId>
<artifactId>
spring-platform-netflix-core
</artifactId>
<version>
1.0.0.BUILD-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.netflix.archaius
</groupId>
<artifactId>
archaius-core
</artifactId>
<version>
${archaius.version}
</version>
...
...
@@ -37,6 +42,11 @@
<version>
${eureka.version}
</version>
</dependency>
<dependency>
<groupId>
com.netflix.eureka
</groupId>
<artifactId>
eureka-core
</artifactId>
<version>
${eureka.version}
</version>
</dependency>
<dependency>
<groupId>
com.netflix.feign
</groupId>
<artifactId>
feign-core
</artifactId>
<version>
${feign.version}
</version>
...
...
spring-platform-netflix-core/pom.xml
View file @
0f85b5ac
...
...
@@ -3,9 +3,7 @@
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.springframework.platform
</groupId>
<artifactId>
spring-platform-netflix-core
</artifactId>
<version>
1.0.0.BUILD-SNAPSHOT
</version>
<packaging>
jar
</packaging>
<name>
spring-platform-netflix-core
</name>
<description>
Spring Platform Netflix Core
</description>
...
...
@@ -29,19 +27,28 @@
<dependency>
<groupId>
com.netflix.archaius
</groupId>
<artifactId>
archaius-core
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
com.netflix.eureka
</groupId>
<artifactId>
eureka-client
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
com.netflix.eureka
</groupId>
<artifactId>
eureka-client
</artifactId>
<artifactId>
eureka-core
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
net.java.dev.rome
</groupId>
<artifactId>
rome
</artifactId>
<version>
1.0.0
</version>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
com.netflix.feign
</groupId>
<artifactId>
feign-core
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
com.netflix.feign
</groupId>
...
...
@@ -54,22 +61,27 @@
<dependency>
<groupId>
com.netflix.hystrix
</groupId>
<artifactId>
hystrix-core
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
com.netflix.hystrix
</groupId>
<artifactId>
hystrix-metrics-event-stream
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
com.netflix.hystrix
</groupId>
<artifactId>
hystrix-javanica
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
com.netflix.ribbon
</groupId>
<artifactId>
ribbon-core
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
com.netflix.ribbon
</groupId>
<artifactId>
ribbon-eureka
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
...
...
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaServerAutoConfiguration.java
0 → 100644
View file @
0f85b5ac
/*
* 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
.
platform
.
netflix
.
eureka
;
import
javax.servlet.ServletContext
;
import
javax.servlet.ServletContextEvent
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.SmartLifecycle
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.context.ServletContextAware
;
import
com.netflix.blitz4j.LoggingConfiguration
;
import
com.netflix.eureka.EurekaBootStrap
;
import
com.netflix.eureka.EurekaServerConfig
;
import
com.netflix.eureka.EurekaServerConfigurationManager
;
/**
* @author Dave Syer
*
*/
@Configuration
@EnableConfigurationProperties
(
EurekaServerConfigBean
.
class
)
@ConditionalOnClass
(
EurekaServerConfig
.
class
)
@ConditionalOnExpression
(
"${eureka.server.enabled:true}"
)
public
class
EurekaServerAutoConfiguration
implements
ServletContextAware
,
SmartLifecycle
{
@Autowired
private
EurekaServerConfig
eurekaServerConfig
;
private
ServletContext
servletContext
;
@Autowired
private
ApplicationContext
applicationContext
;
private
boolean
running
;
@Override
public
void
setServletContext
(
ServletContext
servletContext
)
{
this
.
servletContext
=
servletContext
;
}
@Override
public
void
start
()
{
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
new
EurekaBootStrap
()
{
@Override
protected
void
initEurekaEnvironment
()
{
LoggingConfiguration
.
getInstance
().
configure
();
EurekaServerConfigurationManager
.
getInstance
()
.
setConfiguration
(
eurekaServerConfig
);
}
}.
contextInitialized
(
new
ServletContextEvent
(
servletContext
));
running
=
true
;
}
}).
start
();
}
@Override
public
void
stop
()
{
running
=
false
;
}
@Override
public
boolean
isRunning
()
{
return
running
;
}
@Override
public
int
getPhase
()
{
return
0
;
}
@Override
public
boolean
isAutoStartup
()
{
return
true
;
}
@Override
public
void
stop
(
Runnable
callback
)
{
callback
.
run
();
}
}
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaServerConfigBean.java
0 → 100644
View file @
0f85b5ac
/*
* 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
.
platform
.
netflix
.
eureka
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
lombok.Data
;
import
com.netflix.eureka.EurekaServerConfig
;
/**
* @author Dave Syer
*
*/
@Data
@ConfigurationProperties
(
"eureka.server"
)
public
class
EurekaServerConfigBean
implements
EurekaServerConfig
{
private
static
final
int
MINUTES
=
60
*
1000
;
private
String
aWSAccessId
;
private
String
aWSSecretKey
;
private
int
eIPBindRebindRetries
=
3
;
private
int
eIPBindingRetryIntervalMs
=
5
*
MINUTES
;
private
boolean
enableSelfPreservation
=
true
;
@Override
public
boolean
shouldEnableSelfPreservation
()
{
return
enableSelfPreservation
;
}
private
double
renewalPercentThreshold
=
0.85
;
private
int
renewalThresholdUpdateIntervalMs
=
10
*
MINUTES
;
private
int
peerEurekaNodesUpdateIntervalMs
=
15
*
MINUTES
;
private
int
numberOfReplicationRetries
=
5
;
private
int
peerEurekaStatusRefreshTimeIntervalMs
=
30
*
1000
;
private
int
waitTimeInMsWhenSyncEmpty
=
5
*
MINUTES
;
private
int
peerNodeConnectTimeoutMs
=
200
;
private
int
peerNodeReadTimeoutMs
=
200
;
private
int
peerNodeTotalConnections
=
1000
;
private
int
peerNodeTotalConnectionsPerHost
=
500
;
private
int
peerNodeConnectionIdleTimeoutSeconds
=
30
;
private
long
retentionTimeInMSInDeltaQueue
=
3
*
MINUTES
;
private
long
deltaRetentionTimerIntervalInMs
=
30
*
1000
;
private
long
evictionIntervalTimerInMs
=
60
*
1000
;
private
int
aSGQueryTimeoutMs
=
300
;
private
long
aSGUpdateIntervalMs
=
5
*
MINUTES
;
private
long
responseCacheAutoExpirationInSeconds
=
180
;
private
long
responseCacheUpdateIntervalMs
=
30
*
1000
;
private
boolean
disableDelta
;
@Override
public
boolean
shouldDisableDelta
()
{
return
disableDelta
;
}
private
long
maxIdleThreadInMinutesAgeForStatusReplication
=
10
;
private
int
minThreadsForStatusReplication
=
1
;
private
int
maxThreadsForStatusReplication
=
1
;
private
int
maxElementsInStatusReplicationPool
=
10000
;
private
boolean
syncWhenTimestampDiffers
=
true
;
@Override
public
boolean
shouldSyncWhenTimestampDiffers
()
{
return
syncWhenTimestampDiffers
;
}
private
int
registrySyncRetries
=
5
;
private
int
maxElementsInPeerReplicationPool
=
10000
;
private
long
maxIdleThreadAgeInMinutesForPeerReplication
=
15
;
private
int
minThreadsForPeerReplication
=
5
;
private
int
maxThreadsForPeerReplication
=
20
;
private
int
maxTimeForReplication
=
30000
;
private
boolean
primeAwsReplicaConnections
=
true
;
@Override
public
boolean
shouldPrimeAwsReplicaConnections
()
{
return
primeAwsReplicaConnections
;
}
private
boolean
disableDeltaForRemoteRegions
;
@Override
public
boolean
shouldDisableDeltaForRemoteRegions
()
{
return
disableDeltaForRemoteRegions
;
}
private
int
remoteRegionConnectTimeoutMs
=
1000
;
private
int
remoteRegionReadTimeoutMs
=
1000
;
private
int
remoteRegionTotalConnections
=
1000
;
private
int
remoteRegionTotalConnectionsPerHost
=
500
;
private
int
remoteRegionConnectionIdleTimeoutSeconds
=
30
;
private
boolean
gZipContentFromRemoteRegion
=
true
;
@Override
public
boolean
shouldGZipContentFromRemoteRegion
()
{
return
gZipContentFromRemoteRegion
;
}
private
Map
<
String
,
String
>
remoteRegionUrlsWithName
=
new
HashMap
<
String
,
String
>();
private
String
[]
remoteRegionUrls
;
private
Map
<
String
,
Set
<
String
>>
remoteRegionAppWhitelist
;
@Override
public
Set
<
String
>
getRemoteRegionAppWhitelist
(
String
regionName
)
{
if
(
null
==
regionName
)
{
regionName
=
"global"
;
}
else
{
regionName
=
regionName
.
trim
().
toLowerCase
();
}
return
remoteRegionAppWhitelist
.
get
(
regionName
);
}
private
int
remoteRegionRegistryFetchInterval
=
30
;
private
String
remoteRegionTrustStore
=
""
;
private
String
remoteRegionTrustStorePassword
=
"changeit"
;
private
boolean
disableTransparentFallbackToOtherRegion
;
@Override
public
boolean
disableTransparentFallbackToOtherRegion
()
{
return
disableTransparentFallbackToOtherRegion
;
}
private
boolean
batchReplication
;
@Override
public
boolean
shouldBatchReplication
()
{
return
batchReplication
;
}
}
spring-platform-netflix-core/src/main/resources/META-INF/spring.factories
View file @
0f85b5ac
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.springframework.platform.netflix.archaius.ArchaiusAutoConfiguration,\
org.springframework.platform.netflix.eureka.EurekaClientAutoConfiguration,\
org.springframework.platform.netflix.eureka.EurekaServerAutoConfiguration,\
org.springframework.platform.netflix.feign.FeignAutoConfiguration
\ No newline at end of file
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