private void startAppContext(AppContext appContext) throws Exception { AppContextManager.getInstance().setAppContext(appContext); this.appContext = appContext; appContext.init(); }
public TarsInvoker(ServantProxyConfig config, Class<T> api, Url url, ServantClient[] clients) { super(config, api, url, clients); filters = AppContextManager.getInstance().getAppContext() == null ? null : AppContextManager.getInstance().getAppContext().getFilters(FilterKind.CLIENT); }
@SuppressWarnings("unchecked") public <T> T getAttribute(String name) { return (T) getAttribute(name, null); }
private ServantHomeSkeleton getCapHomeSkeleton() { AppContext appContext = AppContextManager.getInstance().getAppContext(); return appContext.getCapHomeSkeleton(this.context.request().getServantName()); }
public void writeResult(Object result) throws IOException { TarsServantResponse response = this.context.response(); response.setRet(TarsHelper.SERVERSUCCESS); response.setCause(null); response.setResult(result); response.asyncCallEnd(); getCapHomeSkeleton().postInvokeCapHomeSkeleton(); Long startTime = this.context.getAttribute(Context.INTERNAL_START_TIME); TarsServantProcessor.printServiceFlowLog(flowLogger, this.context.request(), response.getRet(), (System.currentTimeMillis() - startTime.longValue()), ""); } }
public Object invoke(Method method, Object... args) throws Exception { Object value = null; try { preInvokeCapHomeSkeleton(); value = method.invoke(this.servantImpl, fixParamValueType(method, args)); } finally { if (!ContextManager.getContext().response().isAsyncMode()) { postInvokeCapHomeSkeleton(); } } return value; }
public static AsyncContext startAsync() throws IOException { Context<TarsServantRequest, TarsServantResponse> context = ContextManager.getContext(); AsyncContext aContext = new AsyncContext(context); context.response().asyncCallStart(); context.setAttribute(PORTAL_CAP_ASYNC_CONTEXT_ATTRIBUTE, aContext); return aContext; }
void setAppContext() { AppContextManager.getInstance().setAppContext(this); }
public static Executor get(ServantAdapterConfig config) { return getAndcreateExecutor(config); }
public TarsInvoker(ServantProxyConfig config, Class<T> api, Url url, ServantClient[] clients) { super(config, api, url, clients); filters = AppContextManager.getInstance().getAppContext() == null ? null : AppContextManager.getInstance().getAppContext().getFilters(FilterKind.CLIENT); }
private ServantHomeSkeleton getCapHomeSkeleton() { AppContext appContext = AppContextManager.getInstance().getAppContext(); return appContext.getCapHomeSkeleton(this.context.request().getServantName()); }
public void writeResult(Object result) throws IOException { TarsServantResponse response = this.context.response(); response.setRet(TarsHelper.SERVERSUCCESS); response.setCause(null); response.setResult(result); response.asyncCallEnd(); getCapHomeSkeleton().postInvokeCapHomeSkeleton(); Long startTime = this.context.getAttribute(Context.INTERNAL_START_TIME); TarsServantProcessor.printServiceFlowLog(flowLogger, this.context.request(), response.getRet(), (System.currentTimeMillis() - startTime.longValue()), ""); } }
public Object invoke(Method method, Object... args) throws Exception { Object value = null; try { preInvokeCapHomeSkeleton(); value = method.invoke(this.servantImpl, fixParamValueType(method, args)); } finally { if (!ContextManager.getContext().response().isAsyncMode()) { postInvokeCapHomeSkeleton(); } } return value; }
private void startAppContext(AppContext appContext) throws Exception { AppContextManager.getInstance().setAppContext(appContext); this.appContext = appContext; appContext.init(); }
public static AsyncContext startAsync() throws IOException { Context<TarsServantRequest, TarsServantResponse> context = ContextManager.getContext(); AsyncContext aContext = new AsyncContext(context); context.response().asyncCallStart(); context.setAttribute(PORTAL_CAP_ASYNC_CONTEXT_ATTRIBUTE, aContext); return aContext; }
@SuppressWarnings("unchecked") public <T> T getAttribute(String name) { return (T) this.context.getAttribute(name); }
public TarsInvoker(ServantProxyConfig config, Class<T> api, Url url, ServantClient[] clients) { super(config, api, url, clients); filters = AppContextManager.getInstance().getAppContext() == null ? null : AppContextManager.getInstance().getAppContext().getFilters(FilterKind.CLIENT); }
@SuppressWarnings("unchecked") public <T> T getAttribute(String name) { return (T) getAttribute(name, null); }
public TarsCallbackWrapper(ServantProxyConfig config, String methodName, String remoteIp, int remotePort, long bornTime, TarsServantRequest request, Callback<TarsServantResponse> callback, TarsInvoker invoker) { this.callback = callback; this.config = config; this.objName = config.getSimpleObjectName(); this.methodName = methodName; this.remoteIp = remoteIp; this.remotePort = remotePort; this.bornTime = bornTime; this.request = request; this.filters = AppContextManager.getInstance().getAppContext() == null ? null : AppContextManager.getInstance().getAppContext().getFilters(FilterKind.CALLBACK); this.invoker = invoker; }
public TarsCallbackWrapper(ServantProxyConfig config, String methodName, String remoteIp, int remotePort, long bornTime, TarsServantRequest request, Callback<TarsServantResponse> callback, TarsInvoker invoker) { this.callback = callback; this.config = config; this.objName = config.getSimpleObjectName(); this.methodName = methodName; this.remoteIp = remoteIp; this.remotePort = remotePort; this.bornTime = bornTime; this.request = request; this.filters = AppContextManager.getInstance().getAppContext() == null ? null : AppContextManager.getInstance().getAppContext().getFilters(FilterKind.CALLBACK); this.invoker = invoker; }