當前位置: 首頁>>代碼示例>>Java>>正文


Java OS.TARGET屬性代碼示例

本文整理匯總了Java中net.openhft.chronicle.core.OS.TARGET屬性的典型用法代碼示例。如果您正苦於以下問題:Java OS.TARGET屬性的具體用法?Java OS.TARGET怎麽用?Java OS.TARGET使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在net.openhft.chronicle.core.OS的用法示例。


在下文中一共展示了OS.TARGET屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: test

@Test
    public void test() throws IOException {
        final File cacheRoot = new File(OS.TARGET + "/test.cm3");
        ChronicleMapBuilder<byte[], byte[]> shaToNodeBuilder =
                ChronicleMapBuilder.of(byte[].class, byte[].class)
//                        .name("bytes-to-bytes")
                        .entries(1000000).
                        averageKeySize(20).
                        averageValueSize(30);

        ChronicleMap<byte[], byte[]> shaToNode =
                shaToNodeBuilder.createPersistedTo(cacheRoot);

        shaToNode.put("1".getBytes(), "2".getBytes());

        shaToNodeBuilder.createPersistedTo(cacheRoot);

    }
 
開發者ID:OpenHFT,項目名稱:Chronicle-Map,代碼行數:18,代碼來源:Issue125Test.java

示例2: testWithAsQueueService

@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,代碼行數:37,代碼來源:HelloWorldTest.java


注:本文中的net.openhft.chronicle.core.OS.TARGET屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。