Skip to content
Permalink
Browse files
Update README.md
  • Loading branch information
chickenlj committed Dec 29, 2018
1 parent 17fa9b2 commit 05c7e608b84c4eb41a316b38eb99242af3906044
Showing 1 changed file with 6 additions and 5 deletions.
@@ -1,10 +1,10 @@
# Introduction
There will have two parts in this repo
* AsyncSignal class specially designed to distinguish async method.
* AsyncSignal, specially designed to distinguish async method.
* A compiler hacker processer that is able to generate async counterpart for each method in you Dubbo service interface.

## AsyncSignal
AsyncSignal is an optional convenient type provided to unify your service definitions.
AsyncSignal is an optional convenient type provided to unify your service definitions when you need an extra async method signature.

Imagine you have a Dubbo service defined like this:
```java
@@ -13,12 +13,12 @@ public interface GreetingsService {
}
```

Add an overwrite counterpart method.
Overwrite this method with a new one.
```java
public interface GreetingsService {
String sayHi(String name);
// AsyncSignal is totally optional, you can use any parameter type as long as java allows your overwrite.
// AsyncSignal is totally optional, you can use any parameter type as long as java allows your to do that.
default CompletableFuture<String> sayHi(String name, AsyncSignal signal) {
return CompletableFuture.completedFuture(sayHi(name));
}
@@ -32,4 +32,5 @@ It should run at compile time, and overwrite each method in your service definit
I think we can try to realize it by referencing [lombok](https://projectlombok.org/).

# Conclude
The essential part is to overwrite a new async method. Another way would be to generate a new method with a different name, for example, `sayHiAsync`, then we can get rid of `AsyncSignal`. But there's an obvious flaw of this way, that is, all method level configurators and routers defined to `sayHi` will not take effect.
The essential part is to overwrite a new async method.
Another way would be to generate a new method with a different name, for example, `sayHiAsync`, then we can get rid of `AsyncSignal`. But there's an obvious flaw of this approach, that is, all method level configurators and routers defined to `sayHi` will not take effect anymore.

0 comments on commit 05c7e60

Please sign in to comment.