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


Java IOTools类代码示例

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


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

示例1: testWithAsQueueService

import net.openhft.chronicle.core.io.IOTools; //导入依赖的package包/类
@Test
public void testWithAsQueueService() {
    // acts as three processes in one test
    // process A writes to the HelloWorld interface.
    // process B read fromt he HelloWorld interface and writes to the
    String input = OS.TARGET + "/input-" + System.nanoTime();
    String output = OS.TARGET + "/output-" + System.nanoTime();

    HelloReplier replier = createMock(HelloReplier.class);
    replier.reply("Hello April");
    replier.reply("Hello June");
    replay(replier);

    ServiceWrapperBuilder<HelloReplier> builder = ServiceWrapperBuilder
            .serviceBuilder(input, output, HelloReplier.class, HelloWorldImpl::new)
            .inputSourceId(1).outputSourceId(2);

    try (CloseableHelloWorld helloWorld = builder.inputWriter(CloseableHelloWorld.class);
         MethodReader replyReader = builder.outputReader(replier);
         ServiceWrapper helloWorldService = builder.get()) {

        helloWorld.hello("April");
        helloWorld.hello("June");

        System.out.println(helloWorldService.inputQueues()[0].dump());
        for (int i = 0; i < 2; i++) {
            while (!replyReader.readOne()) {
                Thread.yield();
            }
        }
        System.out.println(helloWorldService.outputQueue().dump());
        verify(replier);
    } finally {
        IOTools.deleteDirWithFiles(new File(input), 2);
        IOTools.deleteDirWithFiles(new File(output), 2);
    }
}
 
开发者ID:Vanilla-Java,项目名称:Microservices,代码行数:38,代码来源:HelloWorldTest.java

示例2: complete

import net.openhft.chronicle.core.io.IOTools; //导入依赖的package包/类
@Override
public void complete() {
    System.out.println("Cleaning up");
    IOTools.deleteDirWithFiles(queueIn, 2);
    IOTools.deleteDirWithFiles(queue2, 2);
    IOTools.deleteDirWithFiles(queue3, 2);
    IOTools.deleteDirWithFiles(queueOut, 2);
}
 
开发者ID:Vanilla-Java,项目名称:Microservices,代码行数:9,代码来源:MultiThreadedMain.java

示例3: tearDown

import net.openhft.chronicle.core.io.IOTools; //导入依赖的package包/类
@TearDown
public void tearDown() {
    upQueue.close();
    downQueue.close();
    try {
        IOTools.shallowDeleteDirWithFiles(upQueuePath);
        IOTools.shallowDeleteDirWithFiles(downQueuePath);
    } catch (Exception e) {
    }
}
 
开发者ID:Vanilla-Java,项目名称:Microservices,代码行数:11,代码来源:ComponentsBenchmark.java

示例4: clean

import net.openhft.chronicle.core.io.IOTools; //导入依赖的package包/类
private synchronized void clean() {

        if (isCleaned)
            return;
        isCleaned = true;
        final long usedDirectMemory = Jvm.usedDirectMemory();
        IOTools.clean(inBBB.underlyingObject());
        IOTools.clean(outBBB.underlyingObject());

        if (usedDirectMemory == Jvm.usedDirectMemory())
            Jvm.warn().on(getClass(), "nothing cleaned");

    }
 
开发者ID:OpenHFT,项目名称:Chronicle-Network,代码行数:14,代码来源:TcpEventHandler.java


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