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
f9fb23d4
Commit
f9fb23d4
authored
Aug 07, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move piggy back stuff from cloudfoundry
parent
f85e3d13
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
0 deletions
+92
-0
LeaseManagerLite.java
...work/platform/netflix/eureka/advice/LeaseManagerLite.java
+28
-0
PiggybackMethodInterceptor.java
...orm/netflix/eureka/advice/PiggybackMethodInterceptor.java
+64
-0
No files found.
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/advice/LeaseManagerLite.java
0 → 100644
View file @
f9fb23d4
/*
* 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
.
advice
;
import
com.netflix.appinfo.InstanceInfo
;
/**
* @author Dave Syer
*
*/
public
interface
LeaseManagerLite
{
void
register
(
final
InstanceInfo
info
,
final
boolean
isReplication
);
}
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/advice/PiggybackMethodInterceptor.java
0 → 100644
View file @
f9fb23d4
/*
* 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
.
advice
;
import
java.lang.reflect.Method
;
import
org.aopalliance.intercept.MethodInterceptor
;
import
org.aopalliance.intercept.MethodInvocation
;
import
org.springframework.util.ReflectionUtils
;
/**
* @author Dave Syer
*
*/
public
class
PiggybackMethodInterceptor
implements
MethodInterceptor
{
private
Object
delegate
;
private
Class
<?>[]
types
;
public
PiggybackMethodInterceptor
(
Object
delegate
,
Class
<?>...
types
)
{
this
.
delegate
=
delegate
;
this
.
types
=
types
;
}
@Override
public
Object
invoke
(
MethodInvocation
invocation
)
throws
Throwable
{
Object
result
=
invocation
.
proceed
();
invokeAfter
(
invocation
.
getMethod
(),
invocation
.
getArguments
());
return
result
;
}
private
void
invokeAfter
(
Method
method
,
Object
[]
arguments
)
throws
Exception
{
for
(
Class
<?>
type
:
types
)
{
Method
target
=
getTarget
(
type
,
method
);
if
(
target
!=
null
)
{
target
.
invoke
(
delegate
,
arguments
);
return
;
}
}
}
private
Method
getTarget
(
Class
<?>
type
,
Method
method
)
{
Method
target
=
ReflectionUtils
.
findMethod
(
type
,
method
.
getName
(),
method
.
getParameterTypes
());
if
(
target
!=
null
)
{
return
target
;
}
return
null
;
}
}
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