Skip to content
Permalink
Browse files
upgrade dubbo version to 2.7.5-SNAPSHOT
  • Loading branch information
chickenlj committed Oct 30, 2019
1 parent f3d4d3b commit 3fd4431c52a155b0f2ffa6b0425a1029d9db125b
Showing 90 changed files with 150 additions and 165 deletions.
@@ -31,7 +31,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
<dubbo.version>2.7.3</dubbo.version>
<dubbo.version>2.7.5-SNAPSHOT</dubbo.version>
<spring-test.version>4.3.16.RELEASE</spring-test.version>
<junit.version>4.12</junit.version>
<docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
@@ -29,7 +29,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
<dubbo.version>2.7.3</dubbo.version>
<dubbo.version>2.7.5-SNAPSHOT</dubbo.version>
<junit.version>4.12</junit.version>
<docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
<jib-maven-plugin.version>1.2.0</jib-maven-plugin.version>
@@ -31,7 +31,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
<dubbo.version>2.7.3</dubbo.version>
<dubbo.version>2.7.5-SNAPSHOT</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
@@ -32,8 +32,8 @@
<source.level>1.8</source.level>
<target.level>1.8</target.level>
<spring.version>4.3.16.RELEASE</spring.version>
<dubbo.version>2.7.3</dubbo.version>
<dubbo.rpc.version>2.7.3</dubbo.rpc.version>
<dubbo.version>2.7.5-SNAPSHOT</dubbo.version>
<dubbo.rpc.version>2.7.5-SNAPSHOT</dubbo.rpc.version>
<zookeeper.version>3.4.13</zookeeper.version>
<curator.version>4.0.1</curator.version>
<validation-api.version>1.1.0.Final</validation-api.version>
@@ -18,38 +18,34 @@

import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.Filter;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.ListenableFilter;
import org.apache.dubbo.rpc.Result;
import org.apache.dubbo.rpc.RpcException;

/**
*
*/
@Activate(group = {CommonConstants.PROVIDER, CommonConstants.CONSUMER}, order = 9991)
public class NormalAsyncFilter extends ListenableFilter {
public class NormalAsyncFilter implements Filter, Filter.Listener {

public NormalAsyncFilter() {
listener = new NormalListener();
}

@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
return invoker.invoke(invocation);
}

class NormalListener implements Listener {

@Override
public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
System.out.println("normal async received result: " + appResponse.getValue());
}
@Override
public void onMessage(Result appResponse, Invoker<?> invoker, Invocation invocation) {
System.out.println("normal async received result: " + appResponse.getValue());
}

@Override
public void onError(Throwable t, Invoker<?> invoker, Invocation invocation) {
System.out.println("NormalAsyncFilter onError executed: " + t.getMessage());
}
@Override
public void onError(Throwable t, Invoker<?> invoker, Invocation invocation) {
System.out.println("NormalAsyncFilter onError executed: " + t.getMessage());
}

}
@@ -18,40 +18,36 @@

import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.Filter;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.ListenableFilter;
import org.apache.dubbo.rpc.Result;
import org.apache.dubbo.rpc.RpcException;

/**
*
*/
@Activate(group = {CommonConstants.PROVIDER, CommonConstants.CONSUMER}, order = 9997)
public class OnErrorThrowableAsyncFilter extends ListenableFilter {
public class OnErrorThrowableAsyncFilter implements Filter, Filter.Listener {

public OnErrorThrowableAsyncFilter() {
listener = new OnErrorListener();
}

@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
return invoker.invoke(invocation);
}

class OnErrorListener implements Listener {

@Override
public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
@Override
public void onMessage(Result appResponse, Invoker<?> invoker, Invocation invocation) {

}
}

@Override
public void onError(Throwable t, Invoker<?> invoker, Invocation invocation) {
System.out.println("OnErrorThrowableAsyncFilter onError executed: " + t.getMessage());
if (invocation != null) {
throw new RuntimeException("Exception from onError");
}
@Override
public void onError(Throwable t, Invoker<?> invoker, Invocation invocation) {
System.out.println("OnErrorThrowableAsyncFilter onError executed: " + t.getMessage());
if (invocation != null) {
throw new RuntimeException("Exception from onError");
}
}

@@ -18,41 +18,37 @@

import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.Filter;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.ListenableFilter;
import org.apache.dubbo.rpc.Result;
import org.apache.dubbo.rpc.RpcException;

/**
*
*/
@Activate(group = {CommonConstants.PROVIDER, CommonConstants.CONSUMER}, order = 9998)
public class OnResponseThrowableAsyncFilter extends ListenableFilter {
public class OnResponseThrowableAsyncFilter implements Filter, Filter.Listener {

public OnResponseThrowableAsyncFilter() {
listener = new ThrowableListener();
}

@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
return invoker.invoke(invocation);
}

class ThrowableListener implements Listener {

@Override
public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
System.out.println("onResponse received value : " + appResponse.getValue());
if (invocation != null) {
throw new RuntimeException("Exception from onResponse");
}
@Override
public void onMessage(Result appResponse, Invoker<?> invoker, Invocation invocation) {
System.out.println("onResponse received value : " + appResponse.getValue());
if (invocation != null) {
throw new RuntimeException("Exception from onResponse");
}
}

@Override
public void onError(Throwable t, Invoker<?> invoker, Invocation invocation) {
System.out.println("OnResponseThrowableAsyncFilter onError executed: " + t.getMessage());
}
@Override
public void onError(Throwable t, Invoker<?> invoker, Invocation invocation) {
System.out.println("OnResponseThrowableAsyncFilter onError executed: " + t.getMessage());
}

}
@@ -18,38 +18,34 @@

import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.Filter;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.ListenableFilter;
import org.apache.dubbo.rpc.Result;
import org.apache.dubbo.rpc.RpcException;

/**
*
*/
@Activate(group = {CommonConstants.PROVIDER, CommonConstants.CONSUMER}, order = 9999)
public class ProviderErrorAsyncFilter extends ListenableFilter {
public class ProviderErrorAsyncFilter implements Filter, Filter.Listener {

public ProviderErrorAsyncFilter() {
listener = new ThrowableListener();
}

@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
return invoker.invoke(invocation);
}

class ThrowableListener implements Listener {

@Override
public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
@Override
public void onMessage(Result appResponse, Invoker<?> invoker, Invocation invocation) {

}
}

@Override
public void onError(Throwable t, Invoker<?> invoker, Invocation invocation) {
System.out.println("ProviderErrorAsyncFilter onError executed: " + t.getMessage());
}
@Override
public void onError(Throwable t, Invoker<?> invoker, Invocation invocation) {
System.out.println("ProviderErrorAsyncFilter onError executed: " + t.getMessage());
}

}
@@ -21,18 +21,16 @@
import org.apache.dubbo.rpc.Filter;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.ListenableFilter;
import org.apache.dubbo.rpc.Result;
import org.apache.dubbo.rpc.RpcException;

/**
*
*/
@Activate(group = {CommonConstants.PROVIDER, CommonConstants.CONSUMER}, order = 100000)
public class ThrowableAsyncFilter extends ListenableFilter {
public class ThrowableAsyncFilter implements Filter, Filter.Listener {

public ThrowableAsyncFilter() {
listener = new ThrowableListener();
}

@Override
@@ -43,17 +41,14 @@ public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcExcept
return invoker.invoke(invocation);
}

class ThrowableListener implements Filter.Listener {

@Override
public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
@Override
public void onMessage(Result appResponse, Invoker<?> invoker, Invocation invocation) {

}
}

@Override
public void onError(Throwable t, Invoker<?> invoker, Invocation invocation) {
System.out.println("ThrowableAsyncFilter onError executed: " + t.getMessage());
}
@Override
public void onError(Throwable t, Invoker<?> invoker, Invocation invocation) {
System.out.println("ThrowableAsyncFilter onError executed: " + t.getMessage());
}

}
@@ -31,7 +31,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
<dubbo.version>2.7.3</dubbo.version>
<dubbo.version>2.7.5-SNAPSHOT</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
@@ -43,7 +43,7 @@ public static void main(String[] args) throws Exception {
RpcContext savedServerContext = RpcContext.getServerContext();
CountDownLatch latch = new CountDownLatch(1);
future.whenComplete((v, t) -> {
System.out.println(savedServerContext.getAttachment("server-key1"));
System.out.println((String) savedServerContext.getAttachment("server-key1"));
if (t != null) {
logger.warn("Exception: ", t);
} else {
@@ -30,13 +30,13 @@
import org.slf4j.LoggerFactory;

@Activate(group = {Constants.PROVIDER, Constants.CONSUMER})
public class AsyncPostprocessFilter implements Filter {
public class AsyncPostprocessFilter implements Filter, Filter.Listener {
private static Logger logger = LoggerFactory.getLogger(AsyncPostprocessFilter.class);

@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
RpcContext context = RpcContext.getContext();
String filters = context.getAttachment("filters");
String filters = (String) context.getAttachment("filters");
if (StringUtils.isEmpty(filters)) {
filters = "";
}
@@ -47,9 +47,12 @@ public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcExcept
}

@Override
public Result onResponse(Result result, Invoker<?> invoker, Invocation invocation) {
public void onMessage(Result result, Invoker<?> invoker, Invocation invocation) {
logger.info("Filter get the return value: " + result.getValue());
return result;
}

@Override
public void onError(Throwable t, Invoker<?> invoker, Invocation invocation) {

}
}
@@ -36,7 +36,7 @@ public class LegacyBlockFilter implements Filter {
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
RpcContext context = RpcContext.getContext();
String filters = context.getAttachment("filters");
String filters = (String) context.getAttachment("filters");
if (StringUtils.isEmpty(filters)) {
filters = "";
}
@@ -21,7 +21,6 @@

import org.apache.dubbo.rpc.RpcContext;
import org.apache.dubbo.samples.async.api.AsyncService;
import org.apache.dubbo.samples.async.filter.LegacyBlockFilter;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,11 +35,11 @@ public CompletableFuture<String> sayHello(String name) {
RpcContext savedContext = RpcContext.getContext();
RpcContext savedServerContext = RpcContext.getServerContext();
return CompletableFuture.supplyAsync(() -> {
String received = savedContext.getAttachment("consumer-key1");
String received = (String) savedContext.getAttachment("consumer-key1");
logger.info("consumer-key1 from attachment: " + received);
savedServerContext.setAttachment("server-key1", "server-" + received);

received = savedContext.getAttachment("filters");
received = (String) savedContext.getAttachment("filters");
logger.info("filters from attachment: " + received);
savedServerContext.setAttachment("filters", received);
try {
@@ -31,7 +31,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
<dubbo.version>2.7.3</dubbo.version>
<dubbo.version>2.7.5-SNAPSHOT</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
@@ -31,7 +31,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
<dubbo.version>2.7.3</dubbo.version>
<dubbo.version>2.7.5-SNAPSHOT</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
@@ -31,7 +31,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
<dubbo.version>2.7.3</dubbo.version>
<dubbo.version>2.7.5-SNAPSHOT</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
@@ -28,7 +28,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
<dubbo.version>2.7.3</dubbo.version>
<dubbo.version>2.7.5-SNAPSHOT</dubbo.version>
<junit.version>4.12</junit.version>
<spring-test.version>4.3.16.RELEASE</spring-test.version>
<docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>

0 comments on commit 3fd4431

Please sign in to comment.