Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation/2935#dubbo rpc api #2967

Merged
merged 36 commits into from
Dec 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
4704218
Merge pull request #1 from apache/master
khanimteyaz Dec 6, 2018
3c972a1
Merge pull request #3 from apache/master
khanimteyaz Dec 12, 2018
c0d59b3
added dubbo-rpc-api filter documentation for issue no #2935
khanimteyaz Dec 14, 2018
118c914
wrong @see java.io.File was added, removed this version of checkins
khanimteyaz Dec 14, 2018
f8565a8
Close all ports after tests finish (#2906)
OrDTesters Dec 7, 2018
c1b1c92
fix testCustomExecutor (#2904)
gudegg Dec 7, 2018
b24c1d5
Graceful shutdown enhancement in Spring (#2901)
LiZhenNet Dec 7, 2018
ee81c37
Simplify the code logic of the method AbstractClusterInvoker#reselect…
code4wt Dec 7, 2018
3863623
create AbstractRouter (#2909)
Leishunyu Dec 7, 2018
0f27705
Added javadoc for dubbo-filter module dubbo github issue 2884 (#2921)
khanimteyaz Dec 8, 2018
d84abb7
Enhance unit test (#2920)
lixiaojiee Dec 8, 2018
334df04
Change Readme dubbo-sample hyperlink (#2927)
luchy0120 Dec 10, 2018
72803ba
Simply TagRouter (#2924)
kexianjun Dec 10, 2018
1d46c45
make telnet config work again (#2925)
kexianjun Dec 10, 2018
00f2e48
Remove the log to putRandomPort when one protocol use random port (#2…
tswstarplanet Dec 10, 2018
5e14715
Fix DubboShutdownHook Memory Leak (#2922)
LiZhenNet Dec 10, 2018
83c40a5
Improve UT grammar and remove unnecessary braces. (#2930)
ralf0131 Dec 10, 2018
c2d823c
re-enable testCustomExecutor (#2917)
gudegg Dec 10, 2018
81bd268
Fixing test-order dependency for FstObjectInputTest (#2815)
OrDTesters Dec 10, 2018
9edfeb9
re-enable testCustomExecutor (#2913)
biyuhao Dec 10, 2018
7f5bccb
Resetting ExtensionLoader to remove test order dependencies in Sticky…
OrDTesters Dec 10, 2018
9e71e23
optimize the RondRobinLoadBalance and MockClusterInvoker (#2932)
lixiaojiee Dec 10, 2018
52a9320
[Dubbo-2864] Fix build failed with -Prelease (#2923)
biyuhao Dec 11, 2018
8daad25
Fix telnet can not find method with enum type (#2803)
LiZhenNet Dec 11, 2018
e75d72c
[dubbo-2766] fix the bug of isMatch method of InvokeTelnetHandler (#2…
tswstarplanet Dec 11, 2018
e3c70ff
enhance org.apache.dubbo.rpc.protocol.dubbo.telnet.InvokeTelnetHandle…
beiwei30 Dec 11, 2018
5a5d001
[Dubbo-2766]Fix 2766 and enhance the invoke command (#2801)
kexianjun Dec 11, 2018
8cabc55
Delete useless assignments (#2939)
CrazyHZM Dec 11, 2018
ce37363
Replace anonymous class with method reference (#2929)
igor-suhorukov Dec 11, 2018
fc4cb48
Optimize retry for FailbackRegistry. (#2763)
carryxyh Dec 11, 2018
9a2f958
standardize semantics of all mergers,enhance mergeFactory and testcas…
luchy0120 Dec 12, 2018
9827d97
Modified to lower camel case (#2945)
CrazyHZM Dec 12, 2018
1aa6932
Improve several map iteration (#2938)
biyuhao Dec 12, 2018
d3c3d75
added dubbo-rpc-api filter documentation for issue no #2935
khanimteyaz Dec 14, 2018
ffcacfc
wrong @see java.io.File was added, removed this version of checkins
khanimteyaz Dec 14, 2018
75da9e5
Merge branch 'documentation/2935#dubbo-rpc-api' of https://github.com…
khanimteyaz Dec 17, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,26 @@
import org.apache.dubbo.common.extension.SPI;

/**
* Extension for intercepting the invocation for both service provider and consumer, furthermore, most of
* functions in dubbo are implemented base on the same mechanism. Since every time when remote method is
* invoked, the filter extensions will be executed too, the corresponding penalty should be considered before
* more filters are added.
* <pre>
* They way filter work from sequence point of view is
* <b>
* ...code before filter ...
* invoker.invoke(invocation) //filter work in a filter implementation class
* ...code after filter ...
* </b>
* Caching is implemented in dubbo using filter approach. If cache is configured for invocation then before
* remote call configured caching type's (e.g. Thread Local, JCache etc) implementation invoke method gets called.
* </pre>
* Filter. (SPI, Singleton, ThreadSafe)
*
* @see org.apache.dubbo.rpc.filter.GenericFilter
* @see org.apache.dubbo.rpc.filter.EchoFilter
* @see org.apache.dubbo.rpc.filter.TokenFilter
* @see org.apache.dubbo.rpc.filter.TpsLimitFilter
*/
@SPI
public interface Filter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@
import org.apache.dubbo.rpc.RpcStatus;

/**
* LimitInvokerFilter
* ActiveLimitFilter restrict the concurrent client invocation for a service or service's method from client side.
* To use active limit filter, configured url with <b>actives</b> and provide valid >0 integer value.
* <pre>
* e.g. <dubbo:reference id="demoService" check="false" interface="org.apache.dubbo.demo.DemoService" "actives"="2"/>
* In the above example maximum 2 concurrent invocation is allowed.
* If there are more than configured (in this example 2) is trying to invoke remote method, then rest of invocation
* will wait for configured timeout(default is 0 second) before invocation gets kill by dubbo.
* </pre>
*
* @see Filter
*/
@Activate(group = Constants.CONSUMER, value = Constants.ACTIVES_KEY)
public class ActiveLimitFilter implements Filter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.apache.dubbo.rpc.RpcException;

/**
* ClassLoaderInvokerFilter
* Set the current execution thread class loader to service interface's class loader.
*/
@Activate(group = Constants.PROVIDER, order = -30000)
public class ClassLoaderFilter implements Filter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,18 @@
import java.lang.reflect.Type;

/**
* CompatibleFilter
* CompatibleFilter make the remote method's return value compatible to invoker's version of object.
* To make return object compatible it does
* <pre>
* 1)If the url contain serialization key of type <b>json</b> or <b>fastjson</b> then transform
* the return value to instance of {@link java.util.Map}
* 2)If the return value is not a instance of invoked method's return type available at
* local jvm then POJO conversion.
* 3)If return value is other than above return value as it is.
* </pre>
*
* @see Filter
*
*/
public class CompatibleFilter implements Filter {

Expand All @@ -51,9 +62,11 @@ public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcExcept
String serialization = invoker.getUrl().getParameter(Constants.SERIALIZATION_KEY);
if ("json".equals(serialization)
|| "fastjson".equals(serialization)) {
// If the serialization key is json or fastjson
Type gtype = method.getGenericReturnType();
newValue = PojoUtils.realize(value, type, gtype);
} else if (!type.isInstance(value)) {
//if local service interface's method's return type is not instance of return value
newValue = PojoUtils.isPojo(type)
? PojoUtils.realize(value, type)
: CompatibleTypeUtils.compatibleTypeConvert(value, type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@
import org.apache.dubbo.rpc.RpcInvocation;

/**
* ConsumerContextInvokerFilter
* ConsumerContextFilter set current RpcContext with invoker,invocation, local host, remote host and port
* for consumer invoker.It does it to make the requires info available to execution thread's RpcContext.
*
* @see org.apache.dubbo.rpc.Filter
* @see org.apache.dubbo.rpc.PostProcessFilter
* @see RpcContext
*/
@Activate(group = Constants.CONSUMER, order = -10000)
public class ConsumerContextFilter extends AbstractPostProcessFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
import java.util.Map;

/**
* ContextInvokerFilter
* ContextFilter set the provider RpcContext with invoker, invocation, local port it is using and host for
* current execution thread.
*
* @see RpcContext
* @see org.apache.dubbo.rpc.PostProcessFilter
*/
@Activate(group = Constants.PROVIDER, order = -10000)
public class ContextFilter extends AbstractPostProcessFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
import java.util.Set;

/**
* DeprecatedInvokerFilter
* DeprecatedFilter logs error message if a invoked method has been marked as deprecated. To check whether a method
* is deprecated or not it looks for <b>deprecated</b> attribute value and consider it is deprecated it value is <b>true</b>
*
* @see Filter
*/
@Activate(group = Constants.CONSUMER, value = Constants.DEPRECATED_KEY)
public class DeprecatedFilter implements Filter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.apache.dubbo.rpc.RpcResult;

/**
* EchoInvokerFilter
* Dubbo provided default Echo echo service, which is available for all dubbo provider service interface.
*/
@Activate(group = Constants.PROVIDER, order = -110000)
public class EchoFilter implements Filter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
import java.util.concurrent.Semaphore;

/**
* ThreadLimitInvokerFilter
* The maximum parallel execution request count per method per service for the provider.If the max configured
* <b>executes</b> is set to 10 and if invoke request where it is already 10 then it will throws exception. It
* continue the same behaviour un till it is <10.
*
*/
@Activate(group = Constants.PROVIDER, value = Constants.EXECUTES_KEY)
public class ExecuteLimitFilter implements Filter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
import java.util.Map;

/**
* TokenInvokerFilter
* Perform check whether given provider token is matching with remote token or not. If it does not match
* it will not allow to invoke remote method.
*
* @see Filter
*/
@Activate(group = Constants.PROVIDER, value = Constants.TOKEN_KEY)
public class TokenFilter implements Filter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@
import org.apache.dubbo.rpc.filter.tps.TPSLimiter;

/**
* Limit TPS for either service or service's particular method
*/
* TpsLimitFilter limit the TPS (transaction per second) for all method of a service or a particular method.
* Service or method url can define <b>tps</b> or <b>tps.interval</b> to control this control.It use {@link DefaultTPSLimiter}
* as it limit checker. If a provider service method is configured with <b>tps</b>(optionally with <b>tps.interval</b>),then
* if invocation count exceed the configured <b>tps</b> value (default is -1 which means unlimited) then invocation will get
* RpcException.
* */
@Activate(group = Constants.PROVIDER, value = Constants.TPS_LIMIT_RATE_KEY)
public class TpsLimitFilter implements Filter {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
* DefaultTPSLimiter is a default implementation for tps filter. It is an in memory based implementation for stroring
* tps information. It internally use
*
* @see org.apache.dubbo.rpc.filter.TpsLimitFilter
*/
public class DefaultTPSLimiter implements TPSLimiter {

private final ConcurrentMap<String, StatItem> stats
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

import java.util.concurrent.atomic.AtomicInteger;

/**
* Judge whether a particular invocation of service provider method should be allowed within a configured time interval.
* As a state it contain name of key ( e.g. method), last invocation time, interval and rate count.
*/
class StatItem {

private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
import org.apache.dubbo.common.URL;
import org.apache.dubbo.rpc.Invocation;

/**
* Provide boolean information whether a invocation of a provider service's methods or a particular method
* is allowed within a last invocation and current invocation.
* <pre>
* e.g. if tps for a method m1 is 5 for a minute then if 6th call is made within the span of 1 minute then 6th
* should not be allowed <b>isAllowable</b> will return false.
* </pre>
*/
public interface TPSLimiter {

/**
Expand Down