本文整理汇总了Java中org.apache.thrift.TBaseProcessor类的典型用法代码示例。如果您正苦于以下问题:Java TBaseProcessor类的具体用法?Java TBaseProcessor怎么用?Java TBaseProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TBaseProcessor类属于org.apache.thrift包,在下文中一共展示了TBaseProcessor类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyServerTraces
import org.apache.thrift.TBaseProcessor; //导入依赖的package包/类
@Override
public void verifyServerTraces(PluginTestVerifier verifier) throws Exception {
final InetSocketAddress actualServerAddress = super.environment.getServerAddress();
verifier.verifyTraceCount(2);
Method process = TBaseProcessor.class.getDeclaredMethod("process", TProtocol.class, TProtocol.class);
verifier.verifyDiscreteTrace(
// RootSpan - Thrift Server Invocation
root("THRIFT_SERVER", // ServiceType,
"Thrift Server Invocation", // Method
"com/navercorp/pinpoint/plugin/thrift/dto/EchoService/echo", // rpc
actualServerAddress.getHostName() + ":" + actualServerAddress.getPort(), // endPoint
actualServerAddress.getHostName()), // remoteAddress
// SpanEvent - TBaseProcessor.process
event("THRIFT_SERVER_INTERNAL", process));
verifier.verifyTraceCount(0);
}
示例2: getMethodUri
import org.apache.thrift.TBaseProcessor; //导入依赖的package包/类
private String getMethodUri(Object target) {
String methodUri = ThriftConstants.UNKNOWN_METHOD_URI;
InterceptorScopeInvocation currentTransaction = this.scope.getCurrentInvocation();
Object attachment = currentTransaction.getAttachment();
if (attachment instanceof ThriftClientCallContext && target instanceof TBaseProcessor) {
ThriftClientCallContext clientCallContext = (ThriftClientCallContext)attachment;
String methodName = clientCallContext.getMethodName();
methodUri = ThriftUtils.getProcessorNameAsUri((TBaseProcessor<?>)target);
StringBuilder sb = new StringBuilder(methodUri);
if (!methodUri.endsWith("/")) {
sb.append("/");
}
sb.append(methodName);
methodUri = sb.toString();
}
return methodUri;
}
示例3: main
import org.apache.thrift.TBaseProcessor; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
int port = 8083;
TBaseProcessor<?> processor = new TCalculator.Processor<TCalculator.Iface>(new CalcIfaceImpl());
ThriftServerDef serverDef = ThriftServerDef.newBuilder().listen(port)//
.withProcessor(processor)//
.using(Executors.newCachedThreadPool())//
.clientIdleTimeout(TimeUnit.SECONDS.toMillis(15)).build();
final ServerBootstrap server = new ServerBootstrap(serverDef);
// 启动 Server
server.start();
}
示例4: getThriftProcessMap
import org.apache.thrift.TBaseProcessor; //导入依赖的package包/类
private static Map<String, ProcessFunction<?, ?>> getThriftProcessMap(Object service, Class<?> iface) {
final String name = iface.getName();
if (!name.endsWith("$Iface")) {
return null;
}
final String processorName = name.substring(0, name.length() - 5) + "Processor";
try {
final Class<?> processorClass = Class.forName(processorName, false, iface.getClassLoader());
if (!TBaseProcessor.class.isAssignableFrom(processorClass)) {
return null;
}
final Constructor<?> processorConstructor = processorClass.getConstructor(iface);
@SuppressWarnings("rawtypes")
final TBaseProcessor processor = (TBaseProcessor) processorConstructor.newInstance(service);
@SuppressWarnings("unchecked")
Map<String, ProcessFunction<?, ?>> processMap =
(Map<String, ProcessFunction<?, ?>>) processor.getProcessMapView();
return processMap;
} catch (Exception e) {
logger.debug("Failed to retrieve the process map from: {}", iface, e);
return null;
}
}
示例5: getProcessor
import org.apache.thrift.TBaseProcessor; //导入依赖的package包/类
@JsonIgnore
public TBaseProcessor getProcessor() {
return this.processor;
}
示例6: withProcessor
import org.apache.thrift.TBaseProcessor; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public T withProcessor(@SuppressWarnings("rawtypes") TBaseProcessor processor) {
this.processor = processor;
return (T) this;
}
示例7: create
import org.apache.thrift.TBaseProcessor; //导入依赖的package包/类
@Override
public TProcessor create(HttpServletRequest request) {
return new TBaseProcessor<Hawk.Iface>(
new HawkThriftIface(protocol, request, artemisServer), processMap) {};
}
示例8: getProcessorNameAsUri
import org.apache.thrift.TBaseProcessor; //导入依赖的package包/类
/**
* Returns the name of the specified {@link org.apache.thrift.TBaseProcessor TBaseProcessor}
* as uri to be used in Pinpoint.
*/
public static String getProcessorNameAsUri(TBaseProcessor<?> processor) {
String actualProcessorName = processor.getClass().getName();
return convertDotPathToUriPath(ThriftConstants.PROCESSOR_PATTERN.matcher(actualProcessorName).replaceAll("."));
}