Category : dubbo

Order This article mainly studies dubbo’s MetadataReportService MetadataReportService dubbo-2.7.2/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/integration/MetadataReportService.java public class MetadataReportService { protected final Logger logger = LoggerFactory.getLogger(getClass()); private static volatile MetadataReportService metadataReportService; private static Object lock = new Object(); private MetadataReportFactory metadataReportFactory = ExtensionLoader.getExtensionLoader(MetadataReportFactory.class).getAdaptiveExtension(); MetadataReport metadataReport; URL metadataReportUrl; MetadataReportService(URL metadataReportURL) { if (METADATA_REPORT_KEY.equals(metadataReportURL.getProtocol())) { String protocol = metadataReportURL.getParameter(METADATA_REPORT_KEY, DEFAULT_DIRECTORY); metadataReportURL = URLBuilder.from(metadataReportURL) .setProtocol(protocol) ..

Read more

Order This article mainly studies dubbo’s CommandExecutor CommandExecutor dubbo-2.7.2/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/CommandExecutor.java public interface CommandExecutor { /** * Execute one command and return the execution result * * @param commandContext command context * @return command execution result * @throws NoSuchCommandException */ String execute(CommandContext commandContext) throws NoSuchCommandException; } CommandExecutor defines the execute method, which passes in the CommandContext parameter. ..

Read more

Order This article focuses on dubbo’s DubboSwaggerService DubboSwaggerService dubbo-2.7.2/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/integration/swagger/DubboSwaggerService.java @Path(“dubbo”) @Consumes({MediaType.APPLICATION_JSON, MediaType.TEXT_XML}) @Produces({MediaType.APPLICATION_JSON + “; ” + “charset=UTF-8”, MediaType.TEXT_XML + “; ” + “charset=UTF-8”}) public interface DubboSwaggerService { @GET @Path(“swagger”) public Response getListingJson(@Context Application app, @Context ServletConfig sc, @Context HttpHeaders headers, @Context UriInfo uriInfo) throws JsonProcessingException; } DubboSwaggerService defines the getListingJson method DubboSwaggerApiListingResource dubbo-2.7.2/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/integration/swagger/DubboSwaggerApiListingResource.java @Service ..

Read more

Order This article mainly studies dubbo’s SpringContainer Container dubbo-2.7.2/dubbo-container/dubbo-container-api/src/main/java/org/apache/dubbo/container/Container.java @SPI(“spring”) public interface Container { /** * start method to load the container. */ void start(); /** * stop method to unload the container. */ void stop(); } The Container interface defines the start and stop methods. SpringContainer dubbo-2.7.2/dubbo-container/dubbo-container-spring/src/main/java/org/apache/dubbo/container/spring/SpringContainer.java public class SpringContainer implements Container { public ..

Read more

Order This article mainly studies dubbo’s LogbackContainer LogbackContainer dubbo-2.7.2/dubbo-container/dubbo-container-logback/src/main/java/org/apache/dubbo/container/logback/LogbackContainer.java public class LogbackContainer implements Container { public static final String LOGBACK_FILE = “dubbo.logback.file”; public static final String LOGBACK_LEVEL = “dubbo.logback.level”; public static final String LOGBACK_MAX_HISTORY = “dubbo.logback.maxhistory”; public static final String DEFAULT_LOGBACK_LEVEL = “ERROR”; @Override public void start() { String file = ConfigUtils.getProperty(LOGBACK_FILE); if (file != ..

Read more

Order This article mainly studies dubbo’s ClassLoaderFilter ClassLoaderFilter dubbo-2.7.2/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ClassLoaderFilter.java @Activate(group = CommonConstants.PROVIDER, order = -30000) public class ClassLoaderFilter implements Filter { @Override public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { ClassLoader ocl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(invoker.getInterface().getClassLoader()); try { return invoker.invoke(invocation); } finally { Thread.currentThread().setContextClassLoader(ocl); } } } The ClassLoaderFilter implements the Filter interface. its invoke ..

Read more

Order This article mainly studies dubbo’s ValidationFilter ValidationFilter dubbo-2.7.2/dubbo-filter/dubbo-filter-validation/src/main/java/org/apache/dubbo/validation/filter/ValidationFilter.java @Activate(group = {CONSUMER, PROVIDER}, value = VALIDATION_KEY, order = 10000) public class ValidationFilter implements Filter { private Validation validation; /** * Sets the validation instance for ValidationFilter * @param validation Validation instance injected by dubbo framework based on “validation” attribute value. */ public void setValidation(Validation validation) ..

Read more

Order This article mainly studies dubbo’s CacheFilter CacheFilter dubbo-2.7.2/dubbo-filter/dubbo-filter-cache/src/main/java/org/apache/dubbo/cache/filter/CacheFilter.java @Activate(group = {CONSUMER, PROVIDER}, value = CACHE_KEY) public class CacheFilter implements Filter { private CacheFactory cacheFactory; /** * Dubbo will populate and set the cache factory instance based on service/method/consumer/provider configured * cache attribute value. Dubbo will search for the class name implementing configured <b>cache</b> in ..

Read more

Order This article mainly studies dubbo’s TokenFilter TokenFilter dubbo-2.7.2/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/TokenFilter.java @Activate(group = CommonConstants.PROVIDER, value = TOKEN_KEY) public class TokenFilter implements Filter { @Override public Result invoke(Invoker<?> invoker, Invocation inv) throws RpcException { String token = invoker.getUrl().getParameter(TOKEN_KEY); if (ConfigUtils.isNotEmpty(token)) { Class<?> serviceType = invoker.getInterface(); Map<String, String> attachments = inv.getAttachments(); String remoteToken = attachments == null ? null ..

Read more

Order This article mainly studies dubbo’s StatusChecker Status dubbo-2.7.2/dubbo-common/src/main/java/org/apache/dubbo/common/status/Status.java public class Status { private final Level level; private final String message; private final String description; public Status(Level level) { this(level, null, null); } public Status(Level level, String message) { this(level, message, null); } public Status(Level level, String message, String description) { this.level = level; this.message ..

Read more

Order This article mainly studies dubbo’s TPSLimiter TPSLimiter dubbo-2.7.2/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/tps/TPSLimiter.java public interface TPSLimiter { /** * judge if the current invocation is allowed by TPS rule * * @param url url * @param invocation invocation * @return true allow the current invocation, otherwise, return false */ boolean isAllowable(URL url, Invocation invocation); } TPSLimiter defines isAllowable method ..

Read more

Order This article mainly studies dubbo’s TimeoutFilter. ListenableFilter dubbo-2.7.2/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/ListenableFilter.java public abstract class ListenableFilter implements Filter { protected Listener listener = null; public Listener listener() { return listener; } } The ListenableFilter declaration implements the Filter interface, which mainly defines the listener () method TimeoutFilter dubbo-2.7.2/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/TimeoutFilter.java @Activate(group = CommonConstants.PROVIDER) public class TimeoutFilter extends ListenableFilter { private ..

Read more