本文整理汇总了Java中se.sics.kompics.Kompics类的典型用法代码示例。如果您正苦于以下问题:Java Kompics类的具体用法?Java Kompics怎么用?Java Kompics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Kompics类属于se.sics.kompics包,在下文中一共展示了Kompics类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: handle
import se.sics.kompics.Kompics; //导入依赖的package包/类
@Override
public void handle(StopCollectData event) {
CroupierStats.stopCollectData();
CroupierStats.report(VodConfig.SYSTEM_OVERLAY_ID);
InterAsStats.stopCollectData();
InterAsStats.report(InterAs.SYSTEM_INTER_AS_OVERLAY_ID);
VideoStats.stopCollectData();
VideoStats.report(Video.SYSTEM_VIDEO_OVERLAY_ID);
// experiment finished
if (LSConfig.hasMonitorUrlSet()) {
Experiment e = monitoringClient.findExperiment(String.valueOf(LSConfig.getExperimentId()));
e.setStatus(Experiment.Status.finished);
monitoringClient.editExperiment(e);
}
Kompics.shutdown();
System.exit(0);
}
开发者ID:jimdowling,项目名称:gvod,代码行数:22,代码来源:VideoSimulator.java
示例2: handle
import se.sics.kompics.Kompics; //导入依赖的package包/类
@Override
public void handle(BootstrapTimeout event) {
logger.debug(compName + " boostrap timeout: " + event.getTimeoutId());
BootstrapRequest req = (BootstrapRequest) delegator.doGetContext(event.getTimeoutId());
if (delegator.doCancelRetry(event.getTimeoutId())) {
if (req != null) {
BootstrapResponse response = new BootstrapResponse(
req, false,
req.getOverlay(),
new ArrayList<VodDescriptor>());
delegator.doTrigger(response, bootstrap);
} else {
logger.error(compName + "Couldn't find BootstrapRequest object in BootstrapTimeout handler");
Kompics.shutdown();
System.exit(-1);
}
}
}
开发者ID:jimdowling,项目名称:gvod,代码行数:20,代码来源:BootstrapClient.java
示例3: main
import se.sics.kompics.Kompics; //导入依赖的package包/类
public static void main(String[] args) {
// if (args.length != 4) {
// System.out.println("Usage: host numWorkerThreads numClients delay");
// return;
// }
// server = args[0];
// int numWorkers = Integer.parseInt(args[1]);
// numClients = Integer.parseInt(args[2]);
// delayBetweenBootstraps = Integer.parseInt(args[3]);
server = "b00t.info";
int numWorkers = 4;
numClients = 4;
delayBetweenBootstraps = 2000;
System.setProperty("java.net.preferIPv4Stack", "true");
Kompics.createAndStart(BootstrapClientStress.class, numWorkers);
}
开发者ID:jimdowling,项目名称:gvod,代码行数:18,代码来源:BootstrapClientStress.java
示例4: handle
import se.sics.kompics.Kompics; //导入依赖的package包/类
@Override
public void handle(BootPortBindResponse event) {
if (event.getStatus() == BootPortBindResponse.Status.SUCCESS) {
String webServerAddr = "http:/" + VodConfig.getIp().toString()
+ ":" + BootstrapConfig.getWebSearchPort();
final JettyWebServerConfiguration webConfiguration =
new JettyWebServerConfiguration(VodConfig.getIp(),
BootstrapConfig.getWebSearchPort(),
BootstrapConfig.DEFAULT_WEB_REQUEST_TIMEOUT_MS,
BootstrapConfig.DEFAULT_WEB_THREADS,
webServerAddr);
trigger(new JettyWebServerInit(webConfiguration), web.getControl());
logger.info("Webserver Started. Address={}", webServerAddr + "/1/1/search");
} else {
logger.error(event.getStatus()
+ " - problem binding to port for BootstrapServer: " + event.getPort());
Kompics.shutdown();
System.exit(-2);
}
}
开发者ID:jimdowling,项目名称:gvod,代码行数:21,代码来源:BootstrapServerMain.java
示例5: App
import se.sics.kompics.Kompics; //导入依赖的package包/类
@org.junit.Ignore
public void App() {
setTestObj(this);
assert (true);
Kompics.createAndStart(TestStClientComponent.class, 1);
try {
ProvaBootstrapServerInMemory.semaphore.acquire(EVENT_COUNT);
System.out.println("Finished test.");
} catch (InterruptedException e) {
assert (false);
} finally {
Kompics.shutdown();
}
if (testStatus == false) {
assertTrue(false);
}
}
开发者ID:jimdowling,项目名称:gvod,代码行数:21,代码来源:ProvaBootstrapServerInMemory.java
示例6: App
import se.sics.kompics.Kompics; //导入依赖的package包/类
@org.junit.Ignore
public void App() {
setTestObj(this);
assert (true);
Kompics.createAndStart(TestStClientComponent.class, 1);
try {
ProvaBootstrapServer.semaphore.acquire(EVENT_COUNT);
System.out.println("Finished test.");
} catch (InterruptedException e) {
assert (false);
} finally {
Kompics.shutdown();
}
if (testStatus == false) {
assertTrue(false);
}
}
开发者ID:jimdowling,项目名称:gvod,代码行数:21,代码来源:ProvaBootstrapServer.java
示例7: handle
import se.sics.kompics.Kompics; //导入依赖的package包/类
@Override
public void handle(Fault event) {
for (StackTraceElement ste : event.getFault().getStackTrace()) {
logger.error(ste.toString());
}
Throwable t = event.getFault();
if (t != null) {
if (t.getCause() != null) {
logger.error(t.getCause().toString());
exitErrorDialog("Network fault: " + t.getCause().toString());
}
}
// for whatever reason, didn't call exitErrorDialog
Kompics.shutdown();
System.exit(-1);
}
开发者ID:jimdowling,项目名称:gvod,代码行数:17,代码来源:SwingMain.java
示例8: newClient
import se.sics.kompics.Kompics; //导入依赖的package包/类
public static BlockingClient newClient() {
if (INSTANCE == null) { // Not the nicest singleton solution but fine for this
synchronized (ClientManager.class) {
if (INSTANCE == null) {
try {
//MessageRegistrator.register();
Kompics.createAndStart(ClientManager.class, Runtime.getRuntime().availableProcessors());
startedQ.take();
} catch (InterruptedException ex) {
throw new RuntimeException(ex);
}
}
}
}
return INSTANCE.addClient();
}
开发者ID:CaracalDB,项目名称:CaracalDB,代码行数:17,代码来源:ClientManager.java
示例9: createManager
import se.sics.kompics.Kompics; //导入依赖的package包/类
public static Manager createManager() throws InterruptedException, ExecutionException {
MessageRegistrator.register();
SettableFuture<Manager> managerFuture = SettableFuture.create();
ConfigUpdate up = confB.finalise();
Config.Impl configI = (se.sics.kompics.config.Config.Impl) conf.copy(false);
configI.apply(up, ValueMerger.NONE);
conf = configI;
System.out.println("Address: " + conf.getValue("experiment.self.address", Address.class));
Kompics.setConfig(conf);
Kompics.createAndStart(Manager.class, new Manager.Init(managerFuture));
LOG.debug("Waiting for Manager to start...");
Manager m = managerFuture.get();
LOG.info("Manager started!");
return m;
}
开发者ID:CaracalDB,项目名称:CaracalDB,代码行数:17,代码来源:Main.java
示例10: testApp
import se.sics.kompics.Kompics; //导入依赖的package包/类
public void testApp() {
setTestObj(this);
Kompics.createAndStart(TestResolveIpComponent.class, 1);
long startTime = System.currentTimeMillis();
try {
GetIpTest.semaphore.acquire(EVENT_COUNT);
} catch (InterruptedException e) {
assert (false);
} finally {
long endTime = System.currentTimeMillis();
System.out.println("Time taken: " + (endTime - startTime) + "ms");
System.out.println("Exiting unit test....");
Kompics.shutdown();
}
if (status == false) {
assertTrue(false);
} else {
assertTrue(true);
}
}
开发者ID:jimdowling,项目名称:nat-traverser,代码行数:24,代码来源:GetIpTest.java
示例11: testApp
import se.sics.kompics.Kompics; //导入依赖的package包/类
public void testApp() {
setTestObj(this);
Kompics.createAndStart(TestUpnpComponent.class, 1);
try {
UpnpTest.semaphore.acquire(EVENT_COUNT);
System.out.println("Exiting unit test....");
} catch (InterruptedException e) {
assert (false);
} finally {
Kompics.shutdown();
}
if (status == false) {
assertTrue(false);
} else {
assertTrue(true);
}
}
开发者ID:jimdowling,项目名称:nat-traverser,代码行数:21,代码来源:UpnpTest.java
示例12: runInstance
import se.sics.kompics.Kompics; //导入依赖的package包/类
private void runInstance() {
Kompics.createAndStart(StunClientComponentTester.class, 1);
try {
StunClientTest.semaphore.acquire(1);
if (!res) {
Assert.fail();
}
} catch (Throwable e) {
logger.error(e.getMessage());
e.printStackTrace();
StunClientTest.semaphore.release();
Assert.fail(e.getMessage());
} finally {
Kompics.shutdown();
}
}
开发者ID:jimdowling,项目名称:nat-traverser,代码行数:17,代码来源:StunClientTest.java
示例13: runAtLeastTests
import se.sics.kompics.Kompics; //导入依赖的package包/类
public static synchronized void runAtLeastTests(NetworkGenerator nGen, int numNodes, Transport[] protos) {
LOG.info("\n******************** Running AT LEAST Test ********************\n");
NetworkTest.nGen = nGen;
NetworkTest.numNodes = numNodes;
NetworkTest.protos = protos;
WAIT_FOR.set(1);
msgId.set(0);
messageStatus.clear();
TestUtil.reset("Datagram test (" + Arrays.toString(NetworkTest.protos) + ") Nodes #" + numNodes, 10000); //10 sec timeout for all the connections to be dropped properly
Kompics.createAndStart(LauncherComponent.class, 8, 50);
for (int i = 0; i < numNodes; i++) {
LOG.info("Waiting for {}/{} STOPPED.", i + 1, numNodes);
TestUtil.waitFor(STOPPED);
LOG.info("Got {}/{} STOPPED.", i + 1, numNodes);
}
LOG.info("\n******************** Shutting Down Kompics ********************\n");
Kompics.shutdown();
assertTrue(numNodes <= messageStatus.size());
LOG.info("\n******************** AT LEAST Test Done ********************\n");
}
开发者ID:kompics,项目名称:kompics,代码行数:26,代码来源:NetworkTest.java
示例14: handle
import se.sics.kompics.Kompics; //导入依赖的package包/类
@Override
public void handle(Data event) {
if (first) {
startTS = System.currentTimeMillis();
first = false;
}
System.arraycopy(event.data, 0, data, event.pos, DataMessage.MESSAGE_SIZE);
tracker.add(event.pos);
System.out.println("Received message #"+event.pos);
if (tracker.size() == event.total) {
long endTS = System.currentTimeMillis();
double diff = ((double) endTS - startTS)/1000.0;
double throughput = ((double)data.length)/(diff*1024.0);
System.out.println("Transfer complete! Data received in " + diff + "s with " + throughput + "kb/s");
Kompics.asyncShutdown();
}
}
开发者ID:kompics,项目名称:kompics,代码行数:18,代码来源:Receiver.java
示例15: kolaTest
import se.sics.kompics.Kompics; //导入依赖的package包/类
@Test
public void kolaTest() {
try {
//System.out.println(new java.io.File( "." ).getCanonicalPath());
TestUtil.reset("Kola Test");
Main.main(new String[]{"-p", "-m", "-s", targetPath, "src/test/resources/se/sics/kola/KolaTests.kola", "src/test/resources/se/sics/kola/TestPort.kola"});
compile(targetPath);
ClassLoader cl = new URLClassLoader(new URL[]{(new File(targetPath)).toURI().toURL()});
Class testClass = cl.loadClass("se.sics.kola.KolaTestC");
Kompics.createAndStart(testClass, 1);
TestUtil.waitFor("InitStringA");
TestUtil.waitFor("InitStringB");
TestUtil.waitFor("STARTED");
TestUtil.waitFor("RECEIVED");
TestUtil.waitFor("SingletonEvent");
TestUtil.waitFor("REPLIED");
Kompics.shutdown();
// Object o = testClass.newInstance();
// Method m = testClass.getMethod("test");
// Object ret = m.invoke(o);
// boolean res = ((Boolean) ret);
// Assert.assertTrue(res);
} catch (IOException |
InterruptedException |
ClassNotFoundException |
SecurityException |
IllegalArgumentException ex) {
ex.printStackTrace(System.err);
Assert.fail(ex.getMessage());
}
}
开发者ID:kompics,项目名称:kola,代码行数:34,代码来源:GenerationTest.java
示例16: handle
import se.sics.kompics.Kompics; //导入依赖的package包/类
@Override
public void handle(GenerateReport event) {
CroupierStats.report(VodConfig.SYSTEM_OVERLAY_ID);
GradientStats.summaryReport(VodConfig.SYSTEM_OVERLAY_ID);
if (System.currentTimeMillis() > EXPERIMENT_TIME) {
Kompics.shutdown();
System.exit(0);
}
}
开发者ID:jimdowling,项目名称:gvod,代码行数:10,代码来源:GradientSimulator.java
示例17: handle
import se.sics.kompics.Kompics; //导入依赖的package包/类
@Override
public void handle(GenerateReport event) {
CroupierStats.report(VodConfig.SYSTEM_OVERLAY_ID);
InterAsStats.report(InterAs.SYSTEM_INTER_AS_OVERLAY_ID);
if (System.currentTimeMillis() > EXPERIMENT_TIME) {
Kompics.shutdown();
System.exit(0);
}
}
开发者ID:jimdowling,项目名称:gvod,代码行数:10,代码来源:LsSimulator.java
示例18: main
import se.sics.kompics.Kompics; //导入依赖的package包/类
public static void main(String[] args) {
try {
LSConfig.init(args);
} catch (IOException ex) {
System.err.println("Exiting after parsing command line args");
java.util.logging.Logger.getLogger(VideoMain.class.getName()).log(Level.SEVERE, null, ex);
Kompics.shutdown();
System.exit(-1);
}
System.setProperty("java.net.preferIPv4Stack", "true");
Kompics.createAndStart(VideoMain.class, 2);
}
开发者ID:jimdowling,项目名称:gvod,代码行数:14,代码来源:VideoMain.java
示例19: main
import se.sics.kompics.Kompics; //导入依赖的package包/类
public static void main(String[] args) {
System.setProperty("java.net.preferIPv4Stack", "true");
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
logger.info("Shutting down BootstrapServer...");
//Get the jvm heap size.
long heapSize = Runtime.getRuntime().totalMemory();
//Print the jvm heap size.
logger.debug("Heap Size = " + heapSize);
try {
if (Kompics.getScheduler() != null) {
Kompics.shutdown();
}
} catch (Exception e) {
logger.warn("Error shutting down: " + e.getMessage());
}
}
});
try {
BootstrapConfig.init(args);
Kompics.createAndStart(BootstrapServerMain.class, BootstrapConfig.getNumWorkers());
} catch (IOException ex) {
java.util.logging.Logger.getLogger(BootstrapServerMain.class.getName()).log(Level.SEVERE, null, ex);
}
}
开发者ID:jimdowling,项目名称:gvod,代码行数:28,代码来源:BootstrapServerMain.java
示例20: startGui
import se.sics.kompics.Kompics; //导入依赖的package包/类
private void startGui() {
try {
JwHttpServer.startOrUpdate(
new InetSocketAddress(VodConfig.getMediaPort()),
"/", new BrowserGuiHandler(main));
logger.info("Media server listening at: "
+ VodConfig.LOCALHOST + ":"
+ VodConfig.getMediaPort()
+ "/");
} catch (IOException ex) {
logger.warn("Couldn't bind to BrowserGuiHandler port");
logger.error(ex.getMessage());
Kompics.shutdown();
System.exit(-1);
}
if (VodConfig.GUI) {
logger.info("Starting Swing GUI..");
userInterface = create(SwingComponent.class);
connect(userInterface.getNegative(BootstrapPort.class), bootstrap.getPositive(BootstrapPort.class));
trigger(new UserInterfaceInit(this), userInterface.getControl());
subscribe(handleStartInBackground, userInterface.getNegative(AppMainPort.class));
subscribe(handleDownloadSpeed, userInterface.getNegative(AppMainPort.class));
}
}
开发者ID:jimdowling,项目名称:gvod,代码行数:29,代码来源:SwingMain.java
注:本文中的se.sics.kompics.Kompics类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论