Example usage for org.apache.thrift ProcessFunction getMethodName

List of usage examples for org.apache.thrift ProcessFunction getMethodName

Introduction

In this page you can find the example usage for org.apache.thrift ProcessFunction getMethodName.

Prototype

public String getMethodName() 

Source Link

Usage

From source file:com.baidu.oped.apm.plugin.thrift.interceptor.server.ProcessFunctionProcessInterceptor.java

License:Apache License

@Override
public void before(Object target, Object[] args) {
    if (isDebug) {
        logger.beforeInterceptor(target, args);
    }//from  w w w.  j  a va 2s .  c  o m
    // process(int seqid, TProtocol iprot, TProtocol oprot, I iface)
    if (args.length != 4) {
        return;
    }
    String methodName = ThriftConstants.UNKNOWN_METHOD_NAME;
    if (target instanceof ProcessFunction) {
        ProcessFunction<?, ?> processFunction = (ProcessFunction<?, ?>) target;
        methodName = processFunction.getMethodName();
    }
    ThriftClientCallContext clientCallContext = new ThriftClientCallContext(methodName);
    InterceptorGroupInvocation currentTransaction = this.group.getCurrentInvocation();
    currentTransaction.setAttachment(clientCallContext);
    // Set server marker - server handlers may create a client to call another Thrift server.
    // When this happens, TProtocol interceptors for clients are triggered since technically they're still within THRIFT_SERVER_SCOPE.
    // We set the marker inside server's input protocol to safeguard against such cases.
    Object iprot = args[1];
    if (validateInputProtocol(iprot)) {
        ((ServerMarkerFlagFieldAccessor) iprot)._$APM$_setServerMarkerFlag(true);
    }
}

From source file:com.linecorp.armeria.internal.thrift.ThriftFunction.java

License:Apache License

ThriftFunction(Class<?> serviceType, ProcessFunction<?, ?> func) throws Exception {
    this(serviceType, func.getMethodName(), func, Type.SYNC, getArgFields(func), getResult(func),
            getDeclaredExceptions(func));
}

From source file:com.linecorp.armeria.internal.thrift.ThriftFunction.java

License:Apache License

private static TBase<TBase<?, ?>, TFieldIdEnum> getResult(ProcessFunction<?, ?> func) {
    return getResult0(Type.SYNC, func.getClass(), func.getMethodName());
}

From source file:com.linecorp.armeria.internal.thrift.ThriftFunction.java

License:Apache License

private static TBase<TBase<?, ?>, TFieldIdEnum> getArgs(ProcessFunction<?, ?> func) {
    return getArgs0(Type.SYNC, func.getClass(), func.getMethodName());
}

From source file:com.linecorp.armeria.internal.thrift.ThriftFunction.java

License:Apache License

private static TFieldIdEnum[] getArgFields(ProcessFunction<?, ?> func) {
    return getArgFields0(Type.SYNC, func.getClass(), func.getMethodName());
}

From source file:com.linecorp.armeria.internal.thrift.ThriftFunction.java

License:Apache License

private static Class<?>[] getDeclaredExceptions(ProcessFunction<?, ?> func) {
    return getDeclaredExceptions0(Type.SYNC, func.getClass(), func.getMethodName());
}

From source file:com.linecorp.armeria.server.thrift.ThriftFunction.java

License:Apache License

ThriftFunction(ProcessFunction<?, ?> func) throws Exception {
    this(func.getMethodName(), func, Type.SYNC, getResultType(func));
}

From source file:com.linecorp.armeria.server.thrift.ThriftFunction.java

License:Apache License

private static Class<TBase<TBase<?, ?>, TFieldIdEnum>> getResultType(ProcessFunction<?, ?> func) {
    return getResultType0(Type.SYNC, func.getClass(), func.getMethodName());
}

From source file:com.navercorp.pinpoint.plugin.thrift.interceptor.server.ProcessFunctionProcessInterceptor.java

License:Apache License

@Override
public void before(Object target, Object[] args) {
    if (isDebug) {
        logger.beforeInterceptor(target, args);
    }/* w w w .  j  a va  2s.  co m*/
    // process(int seqid, TProtocol iprot, TProtocol oprot, I iface)
    if (args.length != 4) {
        return;
    }
    String methodName = UNKNOWN_METHOD_NAME;
    if (target instanceof ProcessFunction) {
        ProcessFunction<?, ?> processFunction = (ProcessFunction<?, ?>) target;
        methodName = processFunction.getMethodName();
    }
    ThriftClientCallContext clientCallContext = new ThriftClientCallContext(methodName);
    InterceptorGroupInvocation currentTransaction = this.group.getCurrentInvocation();
    currentTransaction.setAttachment(clientCallContext);
    // Set server marker - server handlers may create a client to call another Thrift server.
    // When this happens, TProtocol interceptors for clients are triggered since technically they're still within THRIFT_SERVER_SCOPE.
    // We set the marker inside server's input protocol to safeguard against such cases.
    Object iprot = args[1];
    if (validateInputProtocol(iprot)) {
        ((ServerMarkerFlagFieldAccessor) iprot)._$PINPOINT$_setServerMarkerFlag(true);
    }
}