All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nepxion.discovery.plugin.strategy.gateway.wrapper.DefaultCallableWrapper Maven / Gradle / Ivy

There is a newer version: 6.22.0
Show newest version
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