Skip to content

Commit

Permalink
Fix attributes missing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
chenzhiguo committed May 8, 2024
1 parent cdfe36f commit b258923
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,10 @@ public String[] attributeNames() {
return this.attributes.keySet().toArray(new String[0]);
}

protected void copyAttributesFrom(AttributeAccessor source) {
public void copyAttributesFrom(AttributeAccessor source) {
String[] attributeNames = source.attributeNames();
String[] var3 = attributeNames;
int var4 = attributeNames.length;

for (int var5 = 0; var5 < var4; ++var5) {
String attributeName = var3[var5];
this.setAttribute(attributeName, source.getAttribute(attributeName));
for (String name : attributeNames) {
this.setAttribute(name, source.getAttribute(name));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.jd.live.agent.governance.interceptor;

import com.jd.live.agent.bootstrap.bytekit.context.MethodContext;
import com.jd.live.agent.bootstrap.util.AttributeAccessorSupport;
import com.jd.live.agent.core.plugin.definition.InterceptorAdaptor;
import com.jd.live.agent.governance.instance.Endpoint;
import com.jd.live.agent.governance.invoke.InboundInvocation;
Expand Down Expand Up @@ -175,14 +176,19 @@ protected O process(R request) {
*/
protected Supplier<Response> createRetrySupplier(MethodContext ctx) {
return () -> {
Response response = null;
try {
return createResponse(ctx.invoke(), null);
response = createResponse(ctx.invoke(), null);
} catch (IllegalAccessException ignored) {
// ignored
} catch (Throwable throwable) {
return createResponse(ctx.getResult(), throwable);
response = createResponse(ctx.getResult(), throwable);
} finally {
if (response instanceof AttributeAccessorSupport) {
((AttributeAccessorSupport) response).copyAttributesFrom(ctx);
}
}
return null;
return response;
};
}

Expand All @@ -208,6 +214,7 @@ protected Object invokeWithRetry(O invocation, MethodContext ctx) {
RetrierFactory retrierFactory = context.getOrDefaultRetrierFactory(retryPolicy.getType());
Retrier retrier = retrierFactory == null ? null : retrierFactory.get(retryPolicy);
if (retrier != null) {
ctx.setAttribute(Retrier.DEADLINE_KEY, System.currentTimeMillis() + retryPolicy.getTimeout());
return retrier.execute(retrySupplier);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.rpc.Invocation;
import com.alibaba.dubbo.rpc.Invoker;
import com.jd.live.agent.bootstrap.bytekit.context.ExecutableContext;
import com.jd.live.agent.bootstrap.bytekit.context.MethodContext;
import com.jd.live.agent.core.plugin.definition.InterceptorAdaptor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
import com.jd.live.agent.governance.config.GovernanceConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
import com.jd.live.agent.governance.config.GovernanceConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
import com.jd.live.agent.governance.config.GovernanceConfig;
Expand Down

0 comments on commit b258923

Please sign in to comment.