public V call() throws Exception { AppIdFactory.setCurrentFactory(new SimpleAppIdFactory(appId, module)); try { final CapedwarfEnvironment previous = CapedwarfEnvironment.setThreadLocalInstance(env); try { return callable.call(); } finally { CapedwarfEnvironment.setThreadLocalInstance(previous); } } finally { AppIdFactory.resetCurrentFactory(); } }
public WireWrapper(Callable<V> callable) { this.appId = AppIdFactory.getAppId(); this.module = AppIdFactory.getModule(); this.env = CapedwarfEnvironment.cloneThreadLocalInstance(); this.callable = callable; }