Package com.bj58.spat.gaea.serializer.component.exception

Examples of com.bj58.spat.gaea.serializer.component.exception.StreamException


    Object response = null;
    Protocol protocol = null;
   
    try {
        protocol = context.getGaeaRequest().getProtocol();
      RequestProtocol request = (RequestProtocol)protocol.getSdpEntity();
     
      sbInvokerMsg.append("protocol version:");
      sbInvokerMsg.append(protocol.getVersion());
      sbInvokerMsg.append("\nfromIP:");
      sbInvokerMsg.append(context.getChannel().getRemoteIP());
      sbInvokerMsg.append("\nlookUP:");
      sbInvokerMsg.append(request.getLookup());
      sbInvokerMsg.append("\nmethodName:");
      sbInvokerMsg.append(request.getMethodName());
      sbInvokerMsg.append("\nparams:");
     
      if(request.getParaKVList() != null){
        for (KeyValuePair kv : request.getParaKVList()) {
          if(kv != null) {
            sbInvokerMsg.append("\n--key:");
            sbInvokerMsg.append(kv.getKey());
            sbInvokerMsg.append("\n--value:");
            sbInvokerMsg.append(kv.getValue());
          } else {
            logger.error("KeyValuePair is null  Lookup:" + request.getLookup() + "--MethodName:" + request.getMethodName());
          }
        }
      }
     
      logger.debug(sbInvokerMsg.toString());
      logger.debug("begin get proxy factory");
     
      // get local proxy
      IProxyStub localProxy = Global.getSingleton().getProxyFactory().getProxy(request.getLookup());
      logger.debug("proxyFactory.getProxy finish");

      if (localProxy == null) {
        ServiceFrameException sfe = new ServiceFrameException(
            "method:ProxyHandle.invoke--msg:" + request.getLookup() + "." + request.getMethodName() + " not fond",
            context.getChannel().getRemoteIP(),
            context.getChannel().getLocalIP(),
            request,
            ErrorState.NotFoundServiceException,
            null);
        response = ExceptionHelper.createError(sfe);
        logger.error("localProxy is null", sfe);
      } else {
        logger.debug("begin localProxy.invoke");
        String swInvoderKey = "InvokeRealService_" + request.getLookup() + "." + request.getMethodName();
        sw.startNew(swInvoderKey, sbInvokerMsg.toString());
        sw.setFromIP(context.getChannel().getRemoteIP());
        sw.setLocalIP(context.getChannel().getLocalIP());
       
        //invoker real service
View Full Code Here


  }

  public void setGaeaRequest(GaeaRequest gaeaRequest) {
    this.gaeaRequest = gaeaRequest;
   
    RequestProtocol r = (RequestProtocol)gaeaRequest.getProtocol().getSdpEntity();
    this.stopWatch.setLookup(r.getLookup());
    this.stopWatch.setMethodName(r.getMethodName());
  }
View Full Code Here

      int outParaSize = gaeaResponse.getOutParaList().size();
      Object[] objArray = new Object[outParaSize];
      for(int i=0; i<outParaSize; i++) {
        objArray[i] = gaeaResponse.getOutParaList().get(i).getOutPara();
      }
            return new ResponseProtocol(gaeaResponse.getReturnValue(), objArray);
        } else {
            return new ResponseProtocol(gaeaResponse.getReturnValue(), null);
        }
  }
View Full Code Here

            }
            return obj;
        }
        int len = inStream.ReadInt32();
        if (len > inStream.MAX_DATA_LEN) {
            throw new StreamException("Data length overflow.");
        }
        if (len == 0) {
            inStream.SetRef(hashcode, StrHelper.EmptyString);
            return StrHelper.EmptyString;
        }
View Full Code Here

        if (isRef > 0) {
            return inStream.GetRef(hashcode);
        }
        int len = inStream.ReadInt32();
        if (len > inStream.MAX_DATA_LEN) {
            throw new StreamException("Data length overflow.");
        }
        Class type = TypeHelper.GetType(typeId);
        if (type == null) {
            throw new ClassNotFoundException("Cannot find class with typId,target class:" + defType.getName() + ",typeId:" + typeId);
        }
View Full Code Here

        if (isRef > 0) {
            return inStream.GetRef(hashcode);
        }
        int len = inStream.ReadInt32();
        if (len > inStream.MAX_DATA_LEN) {
            throw new StreamException("Data length overflow.");
        }
        Class type = TypeHelper.GetType(typeId);
        if (type == null) {
            throw new ClassNotFoundException("Cannot find class with typId,target class:" + defType.getName() + ",typeId:" + typeId);
        }
View Full Code Here

    if (isRef > 0) {
      return inStream.GetRef(hashcode);
    }
    int len = inStream.ReadInt32();
    if (len > inStream.MAX_DATA_LEN) {
      throw new StreamException("Data length overflow.");
    }
    Class type = TypeHelper.GetType(typeId);
    if (type == null) {
      throw new ClassNotFoundException(
          "Cannot find class with typId,target class:" + defType.getName() + ",typeId:" + typeId);
View Full Code Here

        super(buffer, offset, length);
    }

    public void SafeRead(byte[] buffer) throws StreamException, IOException {
        if (this.read(buffer) != buffer.length) {
            throw new StreamException();
        }
    }
View Full Code Here

    }

    public short ReadInt16() throws Exception {
        byte[] buffer = new byte[2];
        if (this.read(buffer) != 2) {
            throw new StreamException();
        }
        return ByteHelper.ToInt16(buffer);
    }
View Full Code Here

    }

    public int ReadInt32() throws Exception {
        byte[] buffer = new byte[4];
        if (this.read(buffer) != 4) {
            throw new StreamException();
        }
        return ByteHelper.ToInt32(buffer);
    }
View Full Code Here

TOP

Related Classes of com.bj58.spat.gaea.serializer.component.exception.StreamException

Copyright © 2018 www.massapicom. 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.