dragon-zhang commented on code in PR #4352:
URL: https://github.com/apache/shenyu/pull/4352#discussion_r1103583578
##########
shenyu-plugin/shenyu-plugin-brpc/src/main/java/org/apache/shenyu/plugin/brpc/cache/ApplicationConfigCache.java:
##########
@@ -62,7 +62,16 @@ public final class ApplicationConfigCache {
private JDKProxyFactory proxyFactory;
- private final LoadingCache<String, AsyncGenericService> cache =
CacheBuilder.newBuilder()
+ private final LoadingCache<String, ServiceConfig> serviceConfigCache =
CacheBuilder.newBuilder()
+ .maximumSize(Constants.CACHE_MAX_COUNT)
+ .build(new CacheLoader<String, ServiceConfig>() {
+ @Override
+ public ServiceConfig load(@NonNull final String key) {
+ return null;
Review Comment:
need give a default `ServiceConfig`.
##########
shenyu-plugin/shenyu-plugin-brpc/src/main/java/org/apache/shenyu/plugin/brpc/cache/ApplicationConfigCache.java:
##########
@@ -116,9 +139,7 @@ public AsyncGenericService build(final MetaData metaData) {
if (Objects.isNull(clientConfig)) {
throw new UnsupportedOperationException("unsupport!!");
}
Review Comment:
When `org.apache.shenyu.plugin.brpc.cache.ApplicationConfigCache#init` is
not called, try to initialize
`org.apache.shenyu.plugin.brpc.cache.ApplicationConfigCache#initService` ,
`org.apache.shenyu.plugin.brpc.cache.ApplicationConfigCache#build` will throw
`UnsupportedOperationException`.
Therefore, we should delay the action of building `AsyncGenericService`
until the `runtime`. Of course, caching `AsyncGenericService` is recommended.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]