当前位置: 首页>>代码示例>>Java>>正文


Java Advice.This方法代码示例

本文整理汇总了Java中net.bytebuddy.asm.Advice.This方法的典型用法代码示例。如果您正苦于以下问题:Java Advice.This方法的具体用法?Java Advice.This怎么用?Java Advice.This使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.bytebuddy.asm.Advice的用法示例。


在下文中一共展示了Advice.This方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: monitorStart

import net.bytebuddy.asm.Advice; //导入方法依赖的package包/类
@Advice.OnMethodEnter(inline = false)
public static void monitorStart(@ParameterNames String parameterNames, @Advice.AllArguments Object[] args,
								@RequestName String requestName, @Advice.Origin("#t") String className,
								@Advice.Origin("#m") String methodName, @Advice.This(optional = true) Object thiz) {
	final String[] paramNames = parameterNames.split(",");
	Map<String, Object> params = new LinkedHashMap<String, Object>();
	for (int i = 0; i < args.length; i++) {
		params.put(paramNames[i], args[i]);
	}

	final MonitoredMethodRequest monitoredRequest = new MonitoredMethodRequest(Stagemonitor.getConfiguration(), requestName, null, params);
	final TracingPlugin tracingPlugin = Stagemonitor.getPlugin(TracingPlugin.class);
	tracingPlugin.getRequestMonitor().monitorStart(monitoredRequest);
	final Span span = TracingPlugin.getCurrentSpan();
	if (requestName == null) {
		span.setOperationName(getBusinessTransationName(thiz != null ? thiz.getClass().getName() : className, methodName));
	}
	span.setTag(MetricsSpanEventListener.ENABLE_TRACKING_METRICS_TAG, true);
}
 
开发者ID:stagemonitor,项目名称:stagemonitor,代码行数:20,代码来源:AbstractTracingTransformer.java

示例2: addHandlers

import net.bytebuddy.asm.Advice; //导入方法依赖的package包/类
/**
 * This code might be executed in the context of the bootstrap class loader. That's why we have to make sure we only
 * call code which is visible. For example, we can't use slf4j or directly reference stagemonitor classes
 */
@Advice.OnMethodEnter
private static void addHandlers(@Advice.Argument(value = 0, readOnly = false) List<Handler> handlerChain, @Advice.This Binding binding) {
	final java.util.logging.Logger logger = java.util.logging.Logger.getLogger("org.stagemonitor.tracing.soap.SoapHandlerTransformer");
	final List<Handler<?>> stagemonitorHandlers = Dispatcher.get("org.stagemonitor.tracing.soap.SoapHandlerTransformer");

	if (stagemonitorHandlers != null) {
		logger.fine("Adding SOAPHandlers " + stagemonitorHandlers + " to handlerChain for Binding " + binding);
		if (handlerChain == null) {
			handlerChain = Collections.emptyList();
		}
		// creating a new list as we don't know if handlerChain is immutable or not
		handlerChain = new ArrayList<Handler>(handlerChain);
		for (Handler<?> stagemonitorHandler : stagemonitorHandlers) {
			if (!handlerChain.contains(stagemonitorHandler) &&
					// makes sure we only add the handler to the correct application
					Dispatcher.isVisibleToCurrentContextClassLoader(stagemonitorHandler)) {
				handlerChain.add(stagemonitorHandler);
			}
		}
		logger.fine("Handler Chain: " + handlerChain);
	} else {
		logger.fine("No SOAPHandlers found in Dispatcher for Binding " + binding);
	}
}
 
开发者ID:stagemonitor,项目名称:stagemonitor,代码行数:29,代码来源:SoapHandlerTransformer.java

示例3: action

import net.bytebuddy.asm.Advice; //导入方法依赖的package包/类
@Advice.OnMethodEnter
public static void action(@Advice.This OffersBrowserGetter browserGetter, @Advice.Origin Method method) {
    new ActionAdviceImpl(browserGetter, method).execute();
}
 
开发者ID:testIT-WebTester,项目名称:webtester2-core,代码行数:5,代码来源:ActionAdvice.java

示例4: onMethodExit

import net.bytebuddy.asm.Advice; //导入方法依赖的package包/类
@Advice.OnMethodExit
public static void onMethodExit(@Advice.This PageFragment pageFragment, @Advice.Origin Method method) {
    try {
        EventProducerImpl impl = THREAD_LOCAL.get();
        if (impl != null) {
            impl.onMethodExit();
        }
    } finally {
        THREAD_LOCAL.remove();

    }
}
 
开发者ID:testIT-WebTester,项目名称:webtester2-core,代码行数:13,代码来源:EventProducerAdvice.java

示例5: verifyAlignment

import net.bytebuddy.asm.Advice; //导入方法依赖的package包/类
public static void verifyAlignment(final int index, final @Advice.This DirectBuffer buffer, final int alignment)
{
    if ((buffer.addressOffset() + index) % alignment != 0)
    {
        final String message = String.format(
            "Unaligned %d-byte access (Index=%d, Buffer Alignment Offset=%d)",
            alignment, index, (int)(buffer.addressOffset() % alignment));

        throw new BufferAlignmentException(message);
    }
}
 
开发者ID:real-logic,项目名称:agrona,代码行数:12,代码来源:BufferAlignmentInterceptor.java

示例6: addReflectiveMonitorMethodCall

import net.bytebuddy.asm.Advice; //导入方法依赖的package包/类
@Advice.OnMethodExit
private static void addReflectiveMonitorMethodCall(@Advice.This Object dataSource, @Advice.Return(readOnly = false) Connection connection, @Advice.Enter long startTime) {
	try {
		Object[] connectionMonitor = (Object[]) ((ThreadLocal) Dispatcher.getValues().get("org.stagemonitor.jdbc.ConnectionMonitor")).get();
		if (connectionMonitor != null) {
			final Method connectionMonitorMethod = (Method) connectionMonitor[1];
			final long duration = System.nanoTime() - startTime;
			// In JBoss, this method is executed in the context of the module class loader which loads the DataSource
			// The connectionMonitor is not accessible from this class loader. That's why we have to use reflection.
			connection = (Connection) connectionMonitorMethod.invoke(connectionMonitor[0], connection, dataSource, duration);
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:stagemonitor,项目名称:stagemonitor,代码行数:16,代码来源:ReflectiveConnectionMonitoringTransformer.java

示例7: mark

import net.bytebuddy.asm.Advice; //导入方法依赖的package包/类
@Advice.OnMethodEnter
public static void mark(@Advice.This PageFragment pageFragment, @Advice.Origin Method method) {
    new MarkingAdviceImpl(pageFragment, method).execute();
}
 
开发者ID:testIT-WebTester,项目名称:webtester2-core,代码行数:5,代码来源:MarkingAdvice.java

示例8: onMethodEnter

import net.bytebuddy.asm.Advice; //导入方法依赖的package包/类
@Advice.OnMethodEnter
public static void onMethodEnter(@Advice.This PageFragment pageFragment, @Advice.Origin Method method) {
    THREAD_LOCAL.remove();
    THREAD_LOCAL.set(new EventProducerImpl(pageFragment, method));
    THREAD_LOCAL.get().onMethodEnter();
}
 
开发者ID:testIT-WebTester,项目名称:webtester2-core,代码行数:7,代码来源:EventProducerAdvice.java

示例9: onInterceptingHttpAccessorCreated

import net.bytebuddy.asm.Advice; //导入方法依赖的package包/类
@Advice.OnMethodExit(inline = false)
public static void onInterceptingHttpAccessorCreated(@Advice.This InterceptingHttpAccessor httpAccessor) {
	final TracingPlugin tracingPlugin = Stagemonitor.getPlugin(TracingPlugin.class);
	httpAccessor.getInterceptors().add(new SpringRestTemplateContextPropagatingInterceptor(tracingPlugin));
}
 
开发者ID:stagemonitor,项目名称:stagemonitor,代码行数:6,代码来源:SpringRestTemplateContextPropagatingTransformer.java

示例10: onBeforeEvaluate

import net.bytebuddy.asm.Advice; //导入方法依赖的package包/类
@Advice.OnMethodEnter(inline = false)
public static void onBeforeEvaluate(@Advice.Argument(0) Environment env, @Advice.This Expression dot) {
	Profiler.start(env.getCurrentTemplate().getName() + ':' + dot.getBeginLine() + '#' + dot.toString());
}
 
开发者ID:stagemonitor,项目名称:stagemonitor,代码行数:5,代码来源:FreemarkerProfilingTransformer.java

示例11: gauges

import net.bytebuddy.asm.Advice; //导入方法依赖的package包/类
@Advice.OnMethodExit
public static void gauges(@Advice.This Object thiz) {
	monitorGauges(thiz);
}
 
开发者ID:stagemonitor,项目名称:stagemonitor,代码行数:5,代码来源:GaugeTransformer.java

示例12: addDirectMonitorMethodCall

import net.bytebuddy.asm.Advice; //导入方法依赖的package包/类
@Advice.OnMethodExit
public static void addDirectMonitorMethodCall(@Advice.This Object dataSource,
											   @Advice.Return(readOnly = false) Connection connection,
											   @Advice.Enter long startTime) {
	connection = monitorGetConnection(dataSource, connection, startTime);
}
 
开发者ID:stagemonitor,项目名称:stagemonitor,代码行数:7,代码来源:DefaultConnectionMonitoringTransformer.java

示例13: enter

import net.bytebuddy.asm.Advice; //导入方法依赖的package包/类
/**
 * Saves the context that is associated with the current scope.
 *
 * <p>The context will be attached when entering the thread's {@link Thread#run()} method.
 *
 * <p>NB: This method is never called as is. Instead, Byte Buddy copies the method's bytecode
 * into Thread#start.
 *
 * @see Advice
 */
@Advice.OnMethodEnter
@SuppressFBWarnings("UPM_UNCALLED_PRIVATE_METHOD")
private static void enter(@Advice.This Thread thread) {
  ContextTrampoline.saveContextForThread(thread);
}
 
开发者ID:census-instrumentation,项目名称:opencensus-java,代码行数:16,代码来源:ThreadInstrumentation.java


注:本文中的net.bytebuddy.asm.Advice.This方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。