You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by il...@apache.org on 2019/07/05 03:35:41 UTC
[dubbo-samples] branch master updated: clean up for
dubbo-samples-cache
This is an automated email from the ASF dual-hosted git repository.
iluo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git
The following commit(s) were added to refs/heads/master by this push:
new fd87bfc clean up for dubbo-samples-cache
fd87bfc is described below
commit fd87bfcd9425996c55a542a809b7a79db3b5bc60
Author: Ian Luo <ia...@gmail.com>
AuthorDate: Fri Jul 5 11:34:13 2019 +0800
clean up for dubbo-samples-cache
---
dubbo-samples-cache/pom.xml | 11 ++++++-----
.../java/org/apache/dubbo/samples/cache/CacheProvider.java | 7 +++++--
.../src/main/resources/spring/cache-consumer.xml | 9 +++++----
.../src/main/resources/spring/cache-provider.xml | 13 +++++++------
4 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/dubbo-samples-cache/pom.xml b/dubbo-samples-cache/pom.xml
index 5b0813c..d032a89 100644
--- a/dubbo-samples-cache/pom.xml
+++ b/dubbo-samples-cache/pom.xml
@@ -36,7 +36,9 @@
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
<maven-failsafe-plugin.version>2.21.0</maven-failsafe-plugin.version>
<image.name>${artifactId}:${dubbo.version}</image.name>
+ <java-image.name>openjdk:8</java-image.name>
<dubbo.port>20880</dubbo.port>
+ <zookeeper.port>2181</zookeeper.port>
<main-class>org.apache.dubbo.samples.cache.CacheProvider</main-class>
</properties>
@@ -104,10 +106,6 @@
</to>
<container>
<mainClass>${main-class}</mainClass>
- <ports>
- <port>${dubbo.port}</port>
- <port>2181</port>
- </ports>
<environment>
<DUBBO_IP_TO_REGISTRY>${dubbo-local-address}</DUBBO_IP_TO_REGISTRY>
</environment>
@@ -134,7 +132,7 @@
<run>
<ports>
<port>${dubbo.port}:${dubbo.port}</port>
- <port>2181:2181</port>
+ <port>${zookeeper.port}:${zookeeper.port}</port>
</ports>
<wait>
<log>dubbo service started</log>
@@ -172,6 +170,9 @@
<goal>verify</goal>
</goals>
<configuration>
+ <systemPropertyVariables>
+ <zookeeper.address>${dubbo-local-address}</zookeeper.address>
+ </systemPropertyVariables>
<includes>
<include>**/*IT.java</include>
</includes>
diff --git a/dubbo-samples-cache/src/main/java/org/apache/dubbo/samples/cache/CacheProvider.java b/dubbo-samples-cache/src/main/java/org/apache/dubbo/samples/cache/CacheProvider.java
index 4f92350..c756274 100644
--- a/dubbo-samples-cache/src/main/java/org/apache/dubbo/samples/cache/CacheProvider.java
+++ b/dubbo-samples-cache/src/main/java/org/apache/dubbo/samples/cache/CacheProvider.java
@@ -21,14 +21,17 @@ package org.apache.dubbo.samples.cache;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import java.util.concurrent.CountDownLatch;
+
public class CacheProvider {
public static void main(String[] args) throws Exception {
new EmbeddedZooKeeper(2181, false).start();
+
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/cache-provider.xml");
context.start();
+
System.out.println("dubbo service started");
- System.in.read();
+ new CountDownLatch(1).await();
}
-
}
diff --git a/dubbo-samples-cache/src/main/resources/spring/cache-consumer.xml b/dubbo-samples-cache/src/main/resources/spring/cache-consumer.xml
index 9fff969..8bd4de7 100644
--- a/dubbo-samples-cache/src/main/resources/spring/cache-consumer.xml
+++ b/dubbo-samples-cache/src/main/resources/spring/cache-consumer.xml
@@ -18,14 +18,15 @@
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
- xmlns="http://www.springframework.org/schema/beans"
+ xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
+ http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
+ <context:property-placeholder/>
<dubbo:application name="cache-consumer"/>
- <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
+ <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
<dubbo:reference id="cacheService" interface="org.apache.dubbo.samples.cache.api.CacheService" cache="true"/>
-</beans>
\ No newline at end of file
+</beans>
diff --git a/dubbo-samples-cache/src/main/resources/spring/cache-provider.xml b/dubbo-samples-cache/src/main/resources/spring/cache-provider.xml
index d63d61e..5bad048 100644
--- a/dubbo-samples-cache/src/main/resources/spring/cache-provider.xml
+++ b/dubbo-samples-cache/src/main/resources/spring/cache-provider.xml
@@ -17,14 +17,15 @@
-->
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
- xmlns="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
+ xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+ xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
+ <context:property-placeholder/>
<dubbo:application name="cache-provider"/>
- <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
+ <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
<dubbo:protocol name="dubbo" port="20880"/>
@@ -32,4 +33,4 @@
<dubbo:service interface="org.apache.dubbo.samples.cache.api.CacheService" ref="cacheService"/>
-</beans>
\ No newline at end of file
+</beans>
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org