Tabnine Logo
SoaHeader.getVersionName
Code IndexAdd Tabnine to your IDE (free)

How to use
getVersionName
method
in
com.isuwang.dapeng.core.SoaHeader

Best Java code snippets using com.isuwang.dapeng.core.SoaHeader.getVersionName (Showing top 20 results out of 315)

origin: isuwang/isuwang-soa

private static String generateKey(SoaHeader soaHeader) {
  return soaHeader.getServiceName() + ":" + soaHeader.getMethodName() + ":" + soaHeader.getVersionName();
}
origin: isuwang/isuwang-soa

  private String generateKey(SoaHeader header) {
    return header.getServiceName() + ":" + header.getMethodName() + ":" + header.getVersionName();
  }
}
origin: com.isuwang/dapeng-remoting-api

@Override
public void doFilter(FilterChain chain) throws TException {
  final long startTime = System.currentTimeMillis();
  final SoaHeader soaHeader = (SoaHeader) chain.getAttribute(StubFilterChain.ATTR_KEY_HEADER);
  try {
    chain.doFilter();
  } finally {
    LOGGER.info("{} {} {} 耗时:{}ms", soaHeader.getServiceName(), soaHeader.getVersionName(), soaHeader.getMethodName(), System.currentTimeMillis() - startTime);
  }
}
origin: isuwang/isuwang-soa

@Override
public void doFilter(FilterChain chain) throws TException {
  final long startTime = System.currentTimeMillis();
  final SoaHeader soaHeader = (SoaHeader) chain.getAttribute(StubFilterChain.ATTR_KEY_HEADER);
  try {
    chain.doFilter();
  } finally {
    LOGGER.info("{} {} {} 耗时:{}ms", soaHeader.getServiceName(), soaHeader.getVersionName(), soaHeader.getMethodName(), System.currentTimeMillis() - startTime);
  }
}
origin: isuwang/isuwang-soa

private static void methodInvoke(Class<?> logClass, SoaHeader soaHeader, String methodName, Consumer<Logger> loggerConsumer, Object... args) {
  try {
    ProcessorKey key = new ProcessorKey(soaHeader.getServiceName(), soaHeader.getVersionName());
    ClassLoader appClassLoader = SoaAppClassLoaderCache.getAppClassLoaderMap().get(key);
    if (appClassLoader != null) {
      Object appLogger = getLogger(appClassLoader, logClass, appClassLoader.hashCode());
      Method infoMethod = getMethod(methodName, logClass, appLogger, appClassLoader.hashCode());
      infoMethod.invoke(appLogger, args);
    } else {
      Logger containerLogger = LoggerFactory.getLogger(logClass);
      loggerConsumer.accept(containerLogger);
    }
  } catch (Exception e) {
    //有异常用容器的logger打日志
    LOGGER.error(e.getMessage());
    Logger containerLogger = LoggerFactory.getLogger(logClass);
    loggerConsumer.accept(containerLogger);
  }
}
origin: isuwang/isuwang-soa

@Override
public void doFilter(FilterChain chain) throws TException {
  final long startTime = System.currentTimeMillis();
  final SoaHeader soaHeader = (SoaHeader) chain.getAttribute(ContainerFilterChain.ATTR_KEY_HEADER);
  final TransactionContext context = (TransactionContext) chain.getAttribute(ContainerFilterChain.ATTR_KEY_CONTEXT);
  try {
    chain.doFilter();
  } finally {
    LOGGER.info("{} {} {} {} 耗时:{}ms", soaHeader.getServiceName(), soaHeader.getVersionName(), soaHeader.getMethodName(), context.getSeqid(), System.currentTimeMillis() - startTime);
  }
}
origin: com.isuwang/dapeng-remoting-api

@Override
public void doFilter(FilterChain chain) throws TException {
  final SoaHeader soaHeader = (SoaHeader) chain.getAttribute(StubFilterChain.ATTR_KEY_HEADER);
  final Object request = chain.getAttribute(StubFilterChain.ATTR_KEY_REQUEST);
  LOGGER.info("{} {} {} request header:{} body:{}", soaHeader.getServiceName(), soaHeader.getVersionName(), soaHeader.getMethodName(), soaHeader.toString(), request.toString());
  try {
    chain.doFilter();
  } finally {
    Object response = chain.getAttribute(StubFilterChain.ATTR_KEY_RESPONSE);
    if (response != null)
      LOGGER.info("{} {} {} response header:{} body:{}", soaHeader.getServiceName(), soaHeader.getVersionName(), soaHeader.getMethodName(), soaHeader.toString(), formatToString(response.toString()));
  }
}
origin: isuwang/isuwang-soa

public Task(TransactionContext context) {
  this.startTime = System.currentTimeMillis();
  this.seqid = context.getSeqid();
  SoaHeader soaHeader = context.getHeader();
  this.serviceName = soaHeader.getServiceName();
  this.versionName = soaHeader.getVersionName();
  this.methodName = soaHeader.getMethodName();
  this.callerFrom = soaHeader.getCallerFrom().isPresent() ? soaHeader.getCallerFrom().get() : null;
  this.callerIp = soaHeader.getCallerIp().isPresent() ? soaHeader.getCallerIp().get() : null;
  this.operatorId = soaHeader.getOperatorId().isPresent() ? soaHeader.getOperatorId().get() : null;
  this.operatorName = soaHeader.getOperatorName().isPresent() ? soaHeader.getOperatorName().get() : null;
  this.customerId = soaHeader.getCustomerId().isPresent() ? soaHeader.getCustomerId().get() : null;
  this.customerName = soaHeader.getCustomerName().isPresent() ? soaHeader.getCustomerName().get() : null;
  this.currentThread = Thread.currentThread();
}
origin: isuwang/isuwang-soa

@Override
public void doFilter(FilterChain chain) throws TException {
  final SoaHeader soaHeader = (SoaHeader) chain.getAttribute(StubFilterChain.ATTR_KEY_HEADER);
  final Object request = chain.getAttribute(StubFilterChain.ATTR_KEY_REQUEST);
  final long startTime = System.currentTimeMillis();
  final InvocationContext context = (InvocationContext) chain.getAttribute(StubFilterChain.ATTR_KEY_CONTEXT);
  LOGGER.info("{} {} {} request", soaHeader.getServiceName(), soaHeader.getVersionName(), soaHeader.getMethodName());
  try {
    chain.doFilter();
  } finally {
    // Object response = chain.getAttribute(StubFilterChain.ATTR_KEY_RESPONSE);
    final long endTime = System.currentTimeMillis();
    LOGGER.info("{} {} {} callee: {}:{} response respCode:{} time:{}ms", soaHeader.getServiceName(), soaHeader.getVersionName(), soaHeader.getMethodName(),
        context.getCalleeIp(), context.getCalleePort(), soaHeader.getRespCode(), endTime-startTime);
  }
}
origin: isuwang/isuwang-soa

  private void writeErrorMessage(ChannelHandlerContext ctx, ByteBuf outputBuf, TransactionContext context, SoaHeader soaHeader, TSoaTransport outputSoaTransport, TSoaServiceProtocol outputProtocol, SoaException e) {
    if (outputProtocol != null) {
      try {
        if (outputBuf.writerIndex() > 0)
          outputBuf.writerIndex(Integer.BYTES);

        soaHeader.setRespCode(Optional.ofNullable(e.getCode()));
        soaHeader.setRespMessage(Optional.ofNullable(e.getMsg()));
        outputProtocol.writeMessageBegin(new TMessage(soaHeader.getServiceName() + ":" + soaHeader.getMethodName(), TMessageType.REPLY, context.getSeqid()));
        outputProtocol.writeMessageEnd();

        outputSoaTransport.flush();

        ctx.writeAndFlush(outputBuf);

        LOGGER.info("{} {} {} response header:{} body:{null}", soaHeader.getServiceName(), soaHeader.getVersionName(), soaHeader.getMethodName(), soaHeader.toString());
      } catch (Throwable e1) {
        LOGGER.error(e1.getMessage(), e1);
      }
    }
  }
}
origin: com.isuwang/dapeng-core

/**
 * SoaHeader验证
 */
@Override
public void validate(SoaHeader bean) throws TException {
  if (bean.getServiceName() == null)
    throw new SoaException(SoaBaseCode.NotNull, "serviceName字段不允许为空");
  if (bean.getMethodName() == null)
    throw new SoaException(SoaBaseCode.NotNull, "methodName字段不允许为空");
  if (bean.getVersionName() == null)
    throw new SoaException(SoaBaseCode.NotNull, "versionName字段不允许为空");
}
origin: isuwang/isuwang-soa

/**
 * SoaHeader验证
 */
@Override
public void validate(SoaHeader bean) throws TException {
  if (bean.getServiceName() == null)
    throw new SoaException(SoaBaseCode.NotNull, "serviceName字段不允许为空");
  if (bean.getMethodName() == null)
    throw new SoaException(SoaBaseCode.NotNull, "methodName字段不允许为空");
  if (bean.getVersionName() == null)
    throw new SoaException(SoaBaseCode.NotNull, "versionName字段不允许为空");
}
origin: com.isuwang/dapeng-route-impl

/**
 * 根据matcher.Id,返回上下文中对应的值
 *
 * @param ctx
 * @param matcher
 * @return
 */
public static Object checkFieldMatcher(InvocationContext ctx, Matcher matcher) {
  Id id = matcher.getId();
  if ("operatorId".equals(id.getName())) {
    return ctx.getHeader().getOperatorId().orElse(null);
  } else if ("callerFrom".equals(id.getName())) {
    return ctx.getHeader().getCallerFrom().orElse(null);
  } else if ("ip".equals(id.getName())) {
    return ctx.getHeader().getCallerIp().orElse(null);
  } else if ("customerId".equals(id.getName())) {
    return ctx.getHeader().getCustomerId().orElse(null);
  } else if ("service".equals(id.getName())) {
    return ctx.getHeader().getServiceName();
  } else if ("method".equals(id.getName())) {
    return ctx.getHeader().getMethodName();
  } else if ("version".equals(id.getName())) {
    return ctx.getHeader().getVersionName();
  } else {
    throw new AssertionError("not support Field: " + id.getName());
  }
}
origin: isuwang/isuwang-soa

/**
 * 根据matcher.Id,返回上下文中对应的值
 *
 * @param ctx
 * @param matcher
 * @return
 */
public static Object checkFieldMatcher(InvocationContext ctx, Matcher matcher) {
  Id id = matcher.getId();
  if ("operatorId".equals(id.getName())) {
    return ctx.getHeader().getOperatorId().orElse(null);
  } else if ("callerFrom".equals(id.getName())) {
    return ctx.getHeader().getCallerFrom().orElse(null);
  } else if ("ip".equals(id.getName())) {
    return ctx.getHeader().getCallerIp().orElse(null);
  } else if ("customerId".equals(id.getName())) {
    return ctx.getHeader().getCustomerId().orElse(null);
  } else if ("service".equals(id.getName())) {
    return ctx.getHeader().getServiceName();
  } else if ("method".equals(id.getName())) {
    return ctx.getHeader().getMethodName();
  } else if ("version".equals(id.getName())) {
    return ctx.getHeader().getVersionName();
  } else {
    throw new AssertionError("not support Field: " + id.getName());
  }
}
origin: com.isuwang/dapeng-core

/**
 * 异步处理,当返回结果被complete时调用
 *
 * @param context
 * @param soaProcessFunction
 * @param result
 * @param out
 * @param future
 */
private void AsyncAccept(Context context, SoaProcessFunction<I, Object, Object, ? extends TBeanSerializer<Object>, ? extends TBeanSerializer<Object>> soaProcessFunction, Object result, TProtocol out, CompletableFuture future) {
  try {
    TransactionContext.Factory.setCurrentInstance((TransactionContext) context);
    SoaHeader soaHeader = context.getHeader();
    LOGGER.info("{} {} {} {} response header:{} body:{}", soaHeader.getServiceName(), soaHeader.getVersionName(), soaHeader.getMethodName(), context.getSeqid(), soaHeader.toString(), formatToString(soaProcessFunction.getResSerializer().toString(result)));
    soaHeader.setRespCode(Optional.of("0000"));
    soaHeader.setRespMessage(Optional.of("成功"));
    out.writeMessageBegin(new TMessage(soaHeader.getMethodName(), TMessageType.CALL, context.getSeqid()));
    soaProcessFunction.getResSerializer().write(result, out);
    out.writeMessageEnd();
    /**
     * 通知外层handler处理结果
     */
    future.complete(context);
  } catch (TException e) {
    e.printStackTrace();
  }
}
origin: isuwang/isuwang-soa

/**
 * 异步处理,当返回结果被complete时调用
 *
 * @param context
 * @param soaProcessFunction
 * @param result
 * @param out
 * @param future
 */
private void AsyncAccept(Context context, SoaProcessFunction<I, Object, Object, ? extends TBeanSerializer<Object>, ? extends TBeanSerializer<Object>> soaProcessFunction, Object result, TProtocol out, CompletableFuture future) {
  try {
    TransactionContext.Factory.setCurrentInstance((TransactionContext) context);
    SoaHeader soaHeader = context.getHeader();
    LOGGER.info("{} {} {} {} response header:{} body:{}", soaHeader.getServiceName(), soaHeader.getVersionName(), soaHeader.getMethodName(), context.getSeqid(), soaHeader.toString(), formatToString(soaProcessFunction.getResSerializer().toString(result)));
    soaHeader.setRespCode(Optional.of("0000"));
    soaHeader.setRespMessage(Optional.of("成功"));
    out.writeMessageBegin(new TMessage(soaHeader.getMethodName(), TMessageType.CALL, context.getSeqid()));
    soaProcessFunction.getResSerializer().write(result, out);
    out.writeMessageEnd();
    /**
     * 通知外层handler处理结果
     */
    future.complete(context);
  } catch (TException e) {
    e.printStackTrace();
  }
}
origin: isuwang/isuwang-soa

/**
 * 异步处理,当返回结果被complete时调用
 *
 * @param context
 * @param soaProcessFunction
 * @param result
 * @param out
 * @param future
 */
private void AsyncAccept(Context context, SoaProcessFunction<I, Object, Object, ? extends TCommonBeanSerializer<Object>, ? extends TCommonBeanSerializer<Object>> soaProcessFunction, Object result, TProtocol out, CompletableFuture future) {
  try {
    TransactionContext.Factory.setCurrentInstance((TransactionContext) context);
    SoaHeader soaHeader = context.getHeader();
    LOGGER.info("{} {} {} {} response header:{} body:{}", soaHeader.getServiceName(), soaHeader.getVersionName(), soaHeader.getMethodName(), context.getSeqid(), soaHeader.toString(), formatToString(soaProcessFunction.getResSerializer().toString(result)));
    soaHeader.setRespCode(Optional.of("0000"));
    soaHeader.setRespMessage(Optional.of("成功"));
    out.writeMessageBegin(new TMessage(soaHeader.getMethodName(), TMessageType.CALL, context.getSeqid()));
    soaProcessFunction.getResSerializer().write(result, out);
    out.writeMessageEnd();
    /**
     * 通知外层handler处理结果
     */
    future.complete(context);
  } catch (TException e) {
    e.printStackTrace();
  }
}
origin: com.isuwang/dapeng-core

LOGGER.info("{} {} {} {} request header:{} body:{}", soaHeader.getServiceName(), soaHeader.getVersionName(), soaHeader.getMethodName(), context.getSeqid(), soaHeader.toString(), formatToString(soaProcessFunction.getReqSerializer().toString(args)));
long startTime = System.currentTimeMillis();
origin: com.isuwang/dapeng-remoting-api

String serviceKey = soaHeader.getServiceName() + "." + soaHeader.getVersionName() + "." + soaHeader.getMethodName() + ".consumer";
RegistryAgent registryAgent = RegistryAgentProxy.getCurrentInstance(RegistryAgentProxy.Type.Client);
origin: isuwang/isuwang-soa

public static PlatformProcessData getNewInstance(SoaHeader soaHeader) {
  PlatformProcessData processData = new PlatformProcessData();
  processData.setServiceName(soaHeader.getServiceName());
  processData.setMethodName(soaHeader.getMethodName());
  processData.setVersionName(soaHeader.getVersionName());
  processData.setServerIP(IPUtils.localIp());
  processData.setServerPort(SoaSystemEnvProperties.SOA_CONTAINER_PORT);
  processData.setIAverageTime(0l);
  processData.setIMaxTime(0l);
  processData.setIMinTime(0l);
  processData.setITotalTime(0l);
  processData.setPAverageTime(0l);
  processData.setPMaxTime(0l);
  processData.setPMinTime(0l);
  processData.setPTotalTime(0l);
  processData.setFailCalls(0);
  processData.setSucceedCalls(0);
  processData.setTotalCalls(0);
  processData.setRequestFlow(0);
  processData.setResponseFlow(0);
  return processData;
}
com.isuwang.dapeng.coreSoaHeadergetVersionName

Popular methods of SoaHeader

  • getMethodName
  • getServiceName
  • <init>
  • setMethodName
  • setServiceName
  • setVersionName
  • getRespCode
  • setCallerFrom
  • getCallerFrom
  • getCustomerId
  • getOperatorId
  • getRespMessage
  • getOperatorId,
  • getRespMessage,
  • getCallerIp,
  • getCustomerName,
  • getOperatorName,
  • setCallerIp,
  • setOperatorId,
  • setOperatorName,
  • setTransactionId

Popular in Java

  • Updating database using SQL prepared statement
  • runOnUiThread (Activity)
  • getContentResolver (Context)
  • addToBackStack (FragmentTransaction)
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Runner (org.openjdk.jmh.runner)
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now