Examples of OptModel


Examples of com.pccw.hessian.support.cache.OptModel

      taskExecuteListener.onPerExecute(method, args);
    }
    /**
     * =========================================缓存块(读)
     */
    OptModel model=(method.getAnnotation(CachePolicy.class)==null || cacheHandler==null)?OptModel.NONE:method.getAnnotation(CachePolicy.class).model();
      if(model.equals(OptModel.READ) || (model.equals(OptModel.BOTH) && cacheHandler.ifReturnFromCahce(method, args))){//如果需要从缓存中获取,则直接从缓存中取
        Object result=cacheHandler.returnFromCahce(method, args);
        if(taskExecuteListener!=null){
          taskExecuteListener.onExecuteSuccess(method, args, result);
          taskExecuteListener.onFinally(method, args,result);
        }
        return result;
      }
     
    if(taskExecuteListener!=null){//如果需要向远程获取数据且发现为异步任务,那么启动异步方法执行任务,本方法直接返回null
      invokeAsyn(proxy, method, args,model,cacheHandler,taskExecuteListener);
      return null;
    }else{//直接阻塞式向远程服务端请求数据
      try {
        Object result=super.invoke(proxy, method, args);
        if(model.equals(OptModel.WRITE) || model.equals(OptModel.BOTH)){
          cacheHandler.onExecuteSuccess(method, args,result);
        }
        return result;
      } catch (Throwable e) {
        throw exceptionHandler.parseException(e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.