當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。