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


Java InstrumentationLoadTimeWeaver.isInstrumentationAvailable方法代码示例

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


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

示例1: setBeanClassLoader

import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入方法依赖的package包/类
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
	LoadTimeWeaver serverSpecificLoadTimeWeaver = createServerSpecificLoadTimeWeaver(classLoader);
	if (serverSpecificLoadTimeWeaver != null) {
		if (logger.isInfoEnabled()) {
			logger.info("Determined server-specific load-time weaver: " +
					serverSpecificLoadTimeWeaver.getClass().getName());
		}
		this.loadTimeWeaver = serverSpecificLoadTimeWeaver;
	}
	else if (InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
		logger.info("Found Spring's JVM agent for instrumentation");
		this.loadTimeWeaver = new InstrumentationLoadTimeWeaver(classLoader);
	}
	else {
		try {
			this.loadTimeWeaver = new ReflectiveLoadTimeWeaver(classLoader);
			logger.info("Using a reflective load-time weaver for class loader: " +
					this.loadTimeWeaver.getInstrumentableClassLoader().getClass().getName());
		}
		catch (IllegalStateException ex) {
			throw new IllegalStateException(ex.getMessage() + " Specify a custom LoadTimeWeaver or start your " +
					"Java virtual machine with Spring's agent: -javaagent:org.springframework.instrument.jar");
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:DefaultContextLoadTimeWeaver.java

示例2: setBeanClassLoader

import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入方法依赖的package包/类
public void setBeanClassLoader(ClassLoader classLoader) {
	LoadTimeWeaver serverSpecificLoadTimeWeaver = createServerSpecificLoadTimeWeaver(classLoader);
	if (serverSpecificLoadTimeWeaver != null) {
		if (logger.isInfoEnabled()) {
			logger.info("Determined server-specific load-time weaver: " +
					serverSpecificLoadTimeWeaver.getClass().getName());
		}
		this.loadTimeWeaver = serverSpecificLoadTimeWeaver;
	}
	else if (InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
		logger.info("Found Spring's JVM agent for instrumentation");
		this.loadTimeWeaver = new InstrumentationLoadTimeWeaver(classLoader);
	}
	else {
		try {
			this.loadTimeWeaver = new ReflectiveLoadTimeWeaver(classLoader);
			logger.info("Using a reflective load-time weaver for class loader: " +
					this.loadTimeWeaver.getInstrumentableClassLoader().getClass().getName());
		}
		catch (IllegalStateException ex) {
			throw new IllegalStateException(ex.getMessage() + " Specify a custom LoadTimeWeaver or start your " +
					"Java virtual machine with Spring's agent: -javaagent:org.springframework.instrument.jar");
		}
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:26,代码来源:DefaultContextLoadTimeWeaver.java

示例3: afterPropertiesSet

import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入方法依赖的package包/类
@Override
public void afterPropertiesSet() {
	if (this.loadTimeWeaver == null && InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
		this.loadTimeWeaver = new InstrumentationLoadTimeWeaver(this.resourcePatternResolver.getClassLoader());
	}
	preparePersistenceUnitInfos();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:DefaultPersistenceUnitManager.java

示例4: initialize

import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入方法依赖的package包/类
public static void initialize(final String args, final Instrumentation inst) {
    if (InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
        throw new IllegalStateException(
                "Instrumentation is already available, the agent should have been loaded already!");
    }

    InstrumentationSavingAgent.premain(args, inst);
}
 
开发者ID:subes,项目名称:invesdwin-instrument,代码行数:9,代码来源:AgentInstrumentationInitializer.java

示例5: main

import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入方法依赖的package包/类
public static void main(String[] args) {
	DynamicInstrumentationLoader.waitForInitialized();
	DynamicInstrumentationLoader.initLoadTimeWeavingContext();
	if (!InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
		throw new IllegalStateException("Instrumentation not available!");
	} else {
		System.out.println("Instrumentation available!");
	}
}
 
开发者ID:subes,项目名称:invesdwin-instrument,代码行数:10,代码来源:Main.java

示例6: detectWeavingMode

import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入方法依赖的package包/类
private String detectWeavingMode() {
    LOGGER.info("PersistenceConfiguration.detectWeavingMode()");
    return InstrumentationLoadTimeWeaver.isInstrumentationAvailable() ? "true" : "static";
}
 
开发者ID:fdlessard,项目名称:SpringBootMagicEightBallProject,代码行数:5,代码来源:PersistenceConfiguration.java

示例7: isInitialized

import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入方法依赖的package包/类
public static boolean isInitialized() {
    return InstrumentationLoadTimeWeaver.isInstrumentationAvailable();
}
 
开发者ID:subes,项目名称:invesdwin-instrument,代码行数:4,代码来源:DynamicInstrumentationLoader.java

示例8: afterPropertiesSet

import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入方法依赖的package包/类
public void afterPropertiesSet() {
	if (this.loadTimeWeaver == null && InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
		this.loadTimeWeaver = new InstrumentationLoadTimeWeaver(this.resourcePatternResolver.getClassLoader());
	}
	preparePersistenceUnitInfos();
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:7,代码来源:DefaultPersistenceUnitManager.java

示例9: shouldUseShadowLoader

import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入方法依赖的package包/类
/**
 * Subclasses should override this method if they wish to disable shadow class loading.
 * <p>The default implementation deactivates shadow class loading if Spring's
 * InstrumentationSavingAgent has been configured on VM startup.
 */
protected boolean shouldUseShadowLoader() {
	return !InstrumentationLoadTimeWeaver.isInstrumentationAvailable();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:9,代码来源:AbstractJpaTests.java


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