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


Java ComponentDefinition类代码示例

本文整理汇总了Java中se.sics.kompics.ComponentDefinition的典型用法代码示例。如果您正苦于以下问题:Java ComponentDefinition类的具体用法?Java ComponentDefinition怎么用?Java ComponentDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: simulate

import se.sics.kompics.ComponentDefinition; //导入依赖的package包/类
/**
 * Executes simulation.
 * 
 * @param main
 *            the main
 */
public final void simulate(Class<? extends ComponentDefinition> main) {
	store();

	try {
		Loader cl = AccessController
				.doPrivileged(new PrivilegedAction<Loader>() {
					@Override
					public Loader run() {
						return new Loader();
					}
				});
		cl.addTranslator(ClassPool.getDefault(), new CodeInterceptor(null, false)); //FIXME @alex I just put *something*
		Thread.currentThread().setContextClassLoader(cl);
		TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
		cl.run(main.getCanonicalName(), null);
	} catch (Throwable e) {
		throw new RuntimeException("Exception caught during simulation", e);
	}
}
 
开发者ID:CaracalDB,项目名称:CaracalDB,代码行数:26,代码来源:SimulationScenario.java

示例2: execute

import se.sics.kompics.ComponentDefinition; //导入依赖的package包/类
/**
 * Execute.
 * 
 * @param main
 *            the main
 */
public final void execute(Class<? extends ComponentDefinition> main) {
	store();
	try {
		Loader cl = AccessController
				.doPrivileged(new PrivilegedAction<Loader>() {
					@Override
					public Loader run() {
						return new Loader();
					}
				});
		Thread.currentThread().setContextClassLoader(cl);
		cl.run(main.getCanonicalName(), null);
	} catch (Throwable e) {
		e.printStackTrace();
	}
}
 
开发者ID:CaracalDB,项目名称:CaracalDB,代码行数:23,代码来源:SimulationScenario.java

示例3: newSimulate

import se.sics.kompics.ComponentDefinition; //导入依赖的package包/类
public static void newSimulate(Class<? extends ComponentDefinition> simulatorClass, SimulationScenario scenario) {
    simulation = true;
    scheduler = new BasicSimulationScheduler();
    Launcher.scenario = scenario;
    Kompics.setScheduler(scheduler);
    Kompics.createAndStart(simulatorClass, 1);
}
 
开发者ID:CaracalDB,项目名称:CaracalDB,代码行数:8,代码来源:Launcher.java

示例4: sim

import se.sics.kompics.ComponentDefinition; //导入依赖的package包/类
/**
 * Sim.
 * 
 * @param main
 *            the main
 * @param args
 *            the args
 */
public final void sim(Class<? extends ComponentDefinition> main,
		String... args) {
	store();

	// 1. validate environment: quit if not Sun
	if (!goodEnv()) {
		throw new RuntimeException("Only Sun JRE usable for simulation");
	}

	// 2. compute boot-string
	String bootString = bootString();

	// 3. check if it already exists; goto 5 if it does
	if (!alreadyInstrumentedBoot(bootString)) {
		// 4. transform and generate boot classes in boot-string directory
		prepareInstrumentationExceptions();
		instrumentBoot(bootString);
	} else {
		prepareInstrumentationExceptions();
	}

	// 5. transform and generate application classes
	instrumentApplication();

	// 6. launch simulation process
	launchSimulation(main, args);
}
 
开发者ID:CaracalDB,项目名称:CaracalDB,代码行数:36,代码来源:SimulationScenario.java

示例5: launchSimulation

import se.sics.kompics.ComponentDefinition; //导入依赖的package包/类
/**
 * Launch simulation.
 * 
 * @param main
 *            the main
 * @param args
 *            the args
 */
private void launchSimulation(Class<? extends ComponentDefinition> main,
		String... args) {
	LinkedList<String> arguments = new LinkedList<String>();

	String java = System.getProperty("java.home");
	String sep = System.getProperty("file.separator");
	String pathSep = System.getProperty("path.separator");
	java += sep + "bin" + sep + "java";

	if (System.getProperty("os.name").startsWith("Windows")) {
		arguments.add("\"" + java + "\"");
	} else {
		arguments.add(java);
	}

	arguments.add("-Xbootclasspath:" + directory + bootString() + pathSep
			+ directory + "application");

	arguments.add("-classpath");
	arguments.add(directory + "application");

	arguments.addAll(getJvmArgs(args));

	arguments.add("-Dscenario=" + System.getProperty("scenario"));

	// add configuration properties
	for (Object key : System.getProperties().keySet()) {
		if (((String) key).contains("configuration"))
			arguments.add("-D" + key + "="
					+ System.getProperty((String) key));
	}

	arguments.add(main.getName());

	arguments.addAll(getApplicationArgs(args));

	ProcessBuilder pb = new ProcessBuilder(arguments);
	pb.redirectErrorStream(true);

	saveSimulationCommandLine(arguments);

	try {
		Process process = pb.start();
		BufferedReader out = new BufferedReader(new InputStreamReader(
				process.getInputStream()));

		String line;
		do {
			line = out.readLine();
			if (line != null) {
				System.out.println(line);
			}
		} while (line != null);
	} catch (IOException e) {
		throw new RuntimeException("Cannot start simulation process", e);
	}
}
 
开发者ID:CaracalDB,项目名称:CaracalDB,代码行数:66,代码来源:SimulationScenario.java

示例6: doCreate

import se.sics.kompics.ComponentDefinition; //导入依赖的package包/类
@Override
    public Component doCreate(Class<? extends ComponentDefinition> definition) {
        // TODO: implement doCreate in kompics core.
//        return create(definition);
        throw new NotImplementedException("delegator.doCreate() not supported yet in kompics");
    }
 
开发者ID:jimdowling,项目名称:nat-traverser,代码行数:7,代码来源:MsgRetryComponent.java

示例7: doCreate

import se.sics.kompics.ComponentDefinition; //导入依赖的package包/类
@Override
public Component doCreate(Class<? extends ComponentDefinition> definition) {
    return null;
}
 
开发者ID:jimdowling,项目名称:nat-traverser,代码行数:5,代码来源:VodComponentTestCase.java

示例8: create

import se.sics.kompics.ComponentDefinition; //导入依赖的package包/类
@Override
public <T extends ComponentDefinition> Component create(Class<T> definition, Init<T> initEvent) {
    return LauncherComponent.this.create(definition, initEvent);
}
 
开发者ID:kompics,项目名称:kompics,代码行数:5,代码来源:NetworkTest.java

示例9: doCreate

import se.sics.kompics.ComponentDefinition; //导入依赖的package包/类
public Component doCreate(Class<? extends ComponentDefinition> definition); 
开发者ID:jimdowling,项目名称:nat-traverser,代码行数:2,代码来源:ComponentDelegator.java

示例10: create

import se.sics.kompics.ComponentDefinition; //导入依赖的package包/类
public <T extends ComponentDefinition> Component create(Class<T> definition, Init<T> initEvent); 
开发者ID:kompics,项目名称:kompics,代码行数:2,代码来源:ComponentProxy.java


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