Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
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
apollo
Commits
e355e6ac
Commit
e355e6ac
authored
Apr 26, 2016
by
Yiming Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cat log in service discovery & Add meta resource placeholder
parent
12f05863
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
2 deletions
+32
-2
.gitignore
.gitignore
+0
-1
TitanEntityManager.java
...a/com/ctrip/apollo/biz/datasource/TitanEntityManager.java
+5
-1
DiscoveryService.java
...om/ctrip/apollo/metaservice/service/DiscoveryService.java
+10
-0
pom.xml
apollo-core/pom.xml
+8
-0
apollo-env.properties
apollo-core/src/main/resources/apollo-env.properties
+9
-0
No files found.
.gitignore
View file @
e355e6ac
...
@@ -28,4 +28,3 @@ dev
...
@@ -28,4 +28,3 @@ dev
fat
fat
uat
uat
prd
prd
apollo-env.properties
apollo-biz/src/main/java/com/ctrip/apollo/biz/datasource/TitanEntityManager.java
View file @
e355e6ac
...
@@ -9,6 +9,8 @@ import org.springframework.context.annotation.Bean;
...
@@ -9,6 +9,8 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Conditional
;
import
org.springframework.context.annotation.Conditional
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
com.dianping.cat.Cat
;
@Component
@Component
@Conditional
(
TitanCondition
.
class
)
@Conditional
(
TitanCondition
.
class
)
public
class
TitanEntityManager
{
public
class
TitanEntityManager
{
...
@@ -22,8 +24,10 @@ public class TitanEntityManager {
...
@@ -22,8 +24,10 @@ public class TitanEntityManager {
Class
clazz
=
Class
.
forName
(
"com.ctrip.datasource.configure.DalDataSourceFactory"
);
Class
clazz
=
Class
.
forName
(
"com.ctrip.datasource.configure.DalDataSourceFactory"
);
Object
obj
=
clazz
.
newInstance
();
Object
obj
=
clazz
.
newInstance
();
Method
method
=
clazz
.
getMethod
(
"createDataSource"
,
new
Class
[]
{
String
.
class
,
String
.
class
});
Method
method
=
clazz
.
getMethod
(
"createDataSource"
,
new
Class
[]
{
String
.
class
,
String
.
class
});
return
((
DataSource
)
method
.
invoke
(
obj
,
DataSource
ds
=
((
DataSource
)
method
.
invoke
(
obj
,
new
Object
[]
{
settings
.
getTitanDbname
(),
settings
.
getTitanUrl
()}));
new
Object
[]
{
settings
.
getTitanDbname
(),
settings
.
getTitanUrl
()}));
Cat
.
logEvent
(
"Apollo.Datasource.Titan"
,
settings
.
getTitanDbname
());
return
ds
;
}
}
}
}
apollo-configservice/src/main/java/com/ctrip/apollo/metaservice/service/DiscoveryService.java
View file @
e355e6ac
package
com
.
ctrip
.
apollo
.
metaservice
.
service
;
package
com
.
ctrip
.
apollo
.
metaservice
.
service
;
import
com.ctrip.apollo.core.ServiceNameConsts
;
import
com.ctrip.apollo.core.ServiceNameConsts
;
import
com.dianping.cat.Cat
;
import
com.netflix.appinfo.InstanceInfo
;
import
com.netflix.appinfo.InstanceInfo
;
import
com.netflix.discovery.EurekaClient
;
import
com.netflix.discovery.EurekaClient
;
import
com.netflix.discovery.shared.Application
;
import
com.netflix.discovery.shared.Application
;
...
@@ -19,16 +20,25 @@ public class DiscoveryService {
...
@@ -19,16 +20,25 @@ public class DiscoveryService {
public
List
<
InstanceInfo
>
getConfigServiceInstances
()
{
public
List
<
InstanceInfo
>
getConfigServiceInstances
()
{
Application
application
=
eurekaClient
.
getApplication
(
ServiceNameConsts
.
APOLLO_CONFIGSERVICE
);
Application
application
=
eurekaClient
.
getApplication
(
ServiceNameConsts
.
APOLLO_CONFIGSERVICE
);
if
(
application
==
null
)
{
Cat
.
logEvent
(
"Apollo.EurekaDiscovery.NotFound"
,
ServiceNameConsts
.
APOLLO_CONFIGSERVICE
);
}
return
application
!=
null
?
application
.
getInstances
()
:
new
ArrayList
<>();
return
application
!=
null
?
application
.
getInstances
()
:
new
ArrayList
<>();
}
}
public
List
<
InstanceInfo
>
getMetaServiceInstances
()
{
public
List
<
InstanceInfo
>
getMetaServiceInstances
()
{
Application
application
=
eurekaClient
.
getApplication
(
ServiceNameConsts
.
APOLLO_METASERVICE
);
Application
application
=
eurekaClient
.
getApplication
(
ServiceNameConsts
.
APOLLO_METASERVICE
);
if
(
application
==
null
)
{
Cat
.
logEvent
(
"Apollo.EurekaDiscovery.NotFound"
,
ServiceNameConsts
.
APOLLO_METASERVICE
);
}
return
application
!=
null
?
application
.
getInstances
()
:
new
ArrayList
<>();
return
application
!=
null
?
application
.
getInstances
()
:
new
ArrayList
<>();
}
}
public
List
<
InstanceInfo
>
getAdminServiceInstances
()
{
public
List
<
InstanceInfo
>
getAdminServiceInstances
()
{
Application
application
=
eurekaClient
.
getApplication
(
ServiceNameConsts
.
APOLLO_ADMINSERVICE
);
Application
application
=
eurekaClient
.
getApplication
(
ServiceNameConsts
.
APOLLO_ADMINSERVICE
);
if
(
application
==
null
)
{
Cat
.
logEvent
(
"Apollo.EurekaDiscovery.NotFound"
,
ServiceNameConsts
.
APOLLO_ADMINSERVICE
);
}
return
application
!=
null
?
application
.
getInstances
()
:
new
ArrayList
<>();
return
application
!=
null
?
application
.
getInstances
()
:
new
ArrayList
<>();
}
}
}
}
apollo-core/pom.xml
View file @
e355e6ac
...
@@ -41,4 +41,12 @@
...
@@ -41,4 +41,12 @@
</dependency>
</dependency>
<!-- end of log -->
<!-- end of log -->
</dependencies>
</dependencies>
<build>
<resources>
<resource>
<directory>
src/main/resources
</directory>
<filtering>
true
</filtering>
</resource>
</resources>
</build>
</project>
</project>
apollo-core/src/main/resources/apollo-env.properties
0 → 100644
View file @
e355e6ac
local.meta
=
http://localhost:8080
dev.meta
=
${dev};
fat.meta
=
${fat};
fws.meta
=
${fws};
uat.meta
=
${uat};
lpt.meta
=
${lpt};
tools.meta
=
${tools};
pro.meta
=
${pro};
\ 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