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
5bded8aa
Commit
5bded8aa
authored
Oct 14, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Eureka into a CF service broker
parent
49db709d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
46 additions
and
12 deletions
+46
-12
EurekaClientConfiguration.java
...ework/cloud/netflix/eureka/EurekaClientConfiguration.java
+1
-2
LeaseManagerLite.java
...amework/cloud/netflix/eureka/advice/LeaseManagerLite.java
+29
-0
PiggybackMethodInterceptor.java
...oud/netflix/eureka/advice/PiggybackMethodInterceptor.java
+1
-4
LeaseManagerMessageBroker.java
...cloud/netflix/eureka/event/LeaseManagerMessageBroker.java
+8
-2
ServoMetricsAutoConfiguration.java
...rk/cloud/netflix/servo/ServoMetricsAutoConfiguration.java
+4
-2
EurekaServerConfiguration.java
...loud/netflix/eureka/server/EurekaServerConfiguration.java
+1
-0
EurekaServerInitializerConfiguration.java
...x/eureka/server/EurekaServerInitializerConfiguration.java
+2
-2
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientConfiguration.java
View file @
5bded8aa
...
@@ -21,7 +21,6 @@ import javax.management.MBeanServer;
...
@@ -21,7 +21,6 @@ import javax.management.MBeanServer;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
...
@@ -146,7 +145,7 @@ public class EurekaClientConfiguration implements SmartLifecycle, Ordered {
...
@@ -146,7 +145,7 @@ public class EurekaClientConfiguration implements SmartLifecycle, Ordered {
@Bean
@Bean
@ConditionalOnMissingBean
@ConditionalOnMissingBean
@ConditionalOn
Bean
(
MBeanServer
.
class
)
@ConditionalOn
Expression
(
"${spring.jmx.enabled:true}"
)
public
EurekaHealthIndicator
eurekaHealthIndicator
(
MBeanServer
server
,
public
EurekaHealthIndicator
eurekaHealthIndicator
(
MBeanServer
server
,
EurekaInstanceConfig
config
)
{
EurekaInstanceConfig
config
)
{
return
new
EurekaHealthIndicator
(
eurekaDiscoveryClient
(),
return
new
EurekaHealthIndicator
(
eurekaDiscoveryClient
(),
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/advice/LeaseManagerLite.java
0 → 100644
View file @
5bded8aa
/*
* 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
.
advice
;
import
com.netflix.appinfo.InstanceInfo
;
import
com.netflix.eureka.lease.LeaseManager
;
/**
* @author Dave Syer
*
*/
public
interface
LeaseManagerLite
<
T
>
extends
LeaseManager
<
T
>
{
void
register
(
InstanceInfo
info
,
boolean
isReplication
);
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/advice/PiggybackMethodInterceptor.java
View file @
5bded8aa
...
@@ -55,10 +55,7 @@ public class PiggybackMethodInterceptor implements MethodInterceptor {
...
@@ -55,10 +55,7 @@ public class PiggybackMethodInterceptor implements MethodInterceptor {
private
Method
getTarget
(
Class
<?>
type
,
Method
method
)
{
private
Method
getTarget
(
Class
<?>
type
,
Method
method
)
{
Method
target
=
ReflectionUtils
.
findMethod
(
type
,
method
.
getName
(),
Method
target
=
ReflectionUtils
.
findMethod
(
type
,
method
.
getName
(),
method
.
getParameterTypes
());
method
.
getParameterTypes
());
if
(
target
!=
null
)
{
return
target
;
return
target
;
}
return
null
;
}
}
}
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/event/LeaseManagerMessageBroker.java
View file @
5bded8aa
...
@@ -9,6 +9,7 @@ import javax.annotation.Nullable;
...
@@ -9,6 +9,7 @@ import javax.annotation.Nullable;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cloud.netflix.eureka.advice.LeaseManagerLite
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContext
;
import
com.google.common.base.Optional
;
import
com.google.common.base.Optional
;
...
@@ -16,16 +17,21 @@ import com.google.common.base.Predicate;
...
@@ -16,16 +17,21 @@ import com.google.common.base.Predicate;
import
com.netflix.appinfo.InstanceInfo
;
import
com.netflix.appinfo.InstanceInfo
;
import
com.netflix.discovery.shared.Application
;
import
com.netflix.discovery.shared.Application
;
import
com.netflix.eureka.PeerAwareInstanceRegistry
;
import
com.netflix.eureka.PeerAwareInstanceRegistry
;
import
com.netflix.eureka.lease.Lease
Manager
;
import
com.netflix.eureka.lease.Lease
;
/**
/**
* @author Spencer Gibb
* @author Spencer Gibb
*/
*/
public
class
LeaseManagerMessageBroker
implements
LeaseManager
<
InstanceInfo
>
{
public
class
LeaseManagerMessageBroker
implements
LeaseManager
Lite
<
InstanceInfo
>
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
LeaseManagerMessageBroker
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
LeaseManagerMessageBroker
.
class
);
@Autowired
@Autowired
private
ApplicationContext
ctxt
;
private
ApplicationContext
ctxt
;
@Override
public
void
register
(
InstanceInfo
info
,
boolean
isReplication
)
{
register
(
info
,
Lease
.
DEFAULT_DURATION_IN_SECS
,
isReplication
);
}
@Override
@Override
public
void
register
(
InstanceInfo
info
,
int
leaseDuration
,
boolean
isReplication
)
{
public
void
register
(
InstanceInfo
info
,
int
leaseDuration
,
boolean
isReplication
)
{
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/servo/ServoMetricsAutoConfiguration.java
View file @
5bded8aa
...
@@ -24,7 +24,9 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
...
@@ -24,7 +24,9 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import
org.springframework.boot.autoconfigure.AutoConfigureBefore
;
import
org.springframework.boot.autoconfigure.AutoConfigureBefore
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -38,12 +40,12 @@ import com.netflix.servo.monitor.Monitors;
...
@@ -38,12 +40,12 @@ import com.netflix.servo.monitor.Monitors;
@ConditionalOnClass
({
Monitors
.
class
,
MetricReader
.
class
})
@ConditionalOnClass
({
Monitors
.
class
,
MetricReader
.
class
})
@ConditionalOnBean
(
MetricReader
.
class
)
@ConditionalOnBean
(
MetricReader
.
class
)
@AutoConfigureBefore
(
EndpointAutoConfiguration
.
class
)
@AutoConfigureBefore
(
EndpointAutoConfiguration
.
class
)
@AutoConfigureAfter
(
MetricRepositoryAutoConfiguration
.
class
)
@AutoConfigureAfter
({
MetricRepositoryAutoConfiguration
.
class
,
JmxAutoConfiguration
.
class
})
@ConditionalOnExpression
(
"${spring.jmx.enabled:true}"
)
public
class
ServoMetricsAutoConfiguration
{
public
class
ServoMetricsAutoConfiguration
{
@Bean
@Bean
@ConditionalOnMissingBean
@ConditionalOnMissingBean
@ConditionalOnBean
(
MBeanServer
.
class
)
public
ServoPublicMetrics
servoPublicMetrics
(
MetricReader
reader
,
MBeanServer
server
)
{
public
ServoPublicMetrics
servoPublicMetrics
(
MetricReader
reader
,
MBeanServer
server
)
{
return
new
ServoPublicMetrics
(
reader
,
server
);
return
new
ServoPublicMetrics
(
reader
,
server
);
}
}
...
...
spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/EurekaServerConfiguration.java
View file @
5bded8aa
...
@@ -36,6 +36,7 @@ public class EurekaServerConfiguration extends WebMvcConfigurerAdapter {
...
@@ -36,6 +36,7 @@ public class EurekaServerConfiguration extends WebMvcConfigurerAdapter {
bean
.
setOrder
(
Ordered
.
LOWEST_PRECEDENCE
);
bean
.
setOrder
(
Ordered
.
LOWEST_PRECEDENCE
);
bean
.
addInitParameter
(
"com.sun.jersey.config.property.packages"
,
bean
.
addInitParameter
(
"com.sun.jersey.config.property.packages"
,
"com.netflix.discovery;com.netflix.eureka"
);
"com.netflix.discovery;com.netflix.eureka"
);
bean
.
addInitParameter
(
ServletContainer
.
FEATURE_FILTER_FORWARD_ON_404
,
"true"
);
bean
.
setUrlPatterns
(
Lists
.
newArrayList
(
"/v2/*"
));
bean
.
setUrlPatterns
(
Lists
.
newArrayList
(
"/v2/*"
));
return
bean
;
return
bean
;
}
}
...
...
spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/EurekaServerInitializerConfiguration.java
View file @
5bded8aa
...
@@ -32,6 +32,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
...
@@ -32,6 +32,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.cloud.netflix.eureka.DiscoveryManagerIntitializer
;
import
org.springframework.cloud.netflix.eureka.DiscoveryManagerIntitializer
;
import
org.springframework.cloud.netflix.eureka.EurekaServerConfigBean
;
import
org.springframework.cloud.netflix.eureka.EurekaServerConfigBean
;
import
org.springframework.cloud.netflix.eureka.advice.LeaseManagerLite
;
import
org.springframework.cloud.netflix.eureka.advice.PiggybackMethodInterceptor
;
import
org.springframework.cloud.netflix.eureka.advice.PiggybackMethodInterceptor
;
import
org.springframework.cloud.netflix.eureka.event.EurekaRegistryAvailableEvent
;
import
org.springframework.cloud.netflix.eureka.event.EurekaRegistryAvailableEvent
;
import
org.springframework.cloud.netflix.eureka.event.EurekaServerStartedEvent
;
import
org.springframework.cloud.netflix.eureka.event.EurekaServerStartedEvent
;
...
@@ -50,7 +51,6 @@ import com.netflix.eureka.EurekaBootStrap;
...
@@ -50,7 +51,6 @@ import com.netflix.eureka.EurekaBootStrap;
import
com.netflix.eureka.EurekaServerConfig
;
import
com.netflix.eureka.EurekaServerConfig
;
import
com.netflix.eureka.EurekaServerConfigurationManager
;
import
com.netflix.eureka.EurekaServerConfigurationManager
;
import
com.netflix.eureka.PeerAwareInstanceRegistry
;
import
com.netflix.eureka.PeerAwareInstanceRegistry
;
import
com.netflix.eureka.lease.LeaseManager
;
/**
/**
* @author Dave Syer
* @author Dave Syer
...
@@ -193,7 +193,7 @@ public class EurekaServerInitializerConfiguration implements ServletContextAware
...
@@ -193,7 +193,7 @@ public class EurekaServerInitializerConfiguration implements ServletContextAware
ProxyFactory
factory
=
new
ProxyFactory
(
instance
);
ProxyFactory
factory
=
new
ProxyFactory
(
instance
);
// ...with the LeaseManagerMessageBroker
// ...with the LeaseManagerMessageBroker
factory
.
addAdvice
(
new
PiggybackMethodInterceptor
(
leaseManagerMessageBroker
(),
factory
.
addAdvice
(
new
PiggybackMethodInterceptor
(
leaseManagerMessageBroker
(),
LeaseManager
.
class
));
LeaseManager
Lite
.
class
));
factory
.
addAdvice
(
new
TrafficOpener
());
factory
.
addAdvice
(
new
TrafficOpener
());
factory
.
setProxyTargetClass
(
true
);
factory
.
setProxyTargetClass
(
true
);
...
...
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