本文整理汇总了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);
}
示例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);
}
}