com.nepxion.discovery.plugin.strategy.gateway.wrapper.DefaultCallableWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of discovery-plugin-strategy-starter-gateway Show documentation
Show all versions of discovery-plugin-strategy-starter-gateway Show documentation
Nepxion Discovery is an enhancement for Spring Cloud Discovery
package com.nepxion.discovery.plugin.strategy.gateway.wrapper;
/**
* Title: Nepxion Discovery
* Description: Nepxion Discovery
* Copyright: Copyright (c) 2017-2050
* Company: Nepxion
* @author Haojun Ren
* @author Hao Huang
* @version 1.0
*/
import java.util.concurrent.Callable;
import org.springframework.web.server.ServerWebExchange;
import com.nepxion.discovery.plugin.strategy.gateway.context.GatewayStrategyContext;
import com.nepxion.discovery.plugin.strategy.wrapper.CallableWrapper;
public class DefaultCallableWrapper implements CallableWrapper {
@Override
public Callable wrapCallable(Callable delegate) {
ServerWebExchange exchange = GatewayStrategyContext.getCurrentContext().getExchange();
return new Callable() {
@Override
public T call() throws Exception {
try {
GatewayStrategyContext.getCurrentContext().setExchange(exchange);
return delegate.call();
} finally {
GatewayStrategyContext.clearCurrentContext();
}
}
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy