use of com.pamirs.pradar.interceptor.ContextTransfer in project LinkAgent by shulieTech.
the class ClientCallStartInterceptor method getContextTransfer.
@Override
protected ContextTransfer getContextTransfer(Advice advice) {
Object[] args = advice.getParameterArray();
if (args == null || args.length != 2) {
return null;
}
if (!(args[1] instanceof Metadata)) {
return null;
}
final Metadata metadata = (Metadata) args[1];
return new ContextTransfer() {
@Override
public void transfer(String keyName, String value) {
Metadata.Key<String> key = Metadata.Key.of(keyName, Metadata.ASCII_STRING_MARSHALLER);
if (null != value) {
metadata.put(key, value);
}
}
};
}
Aggregations